Geocode/address to geo
Zhangchao2 (讨论 | 贡献) (→URL) |
Zhangchao2 (讨论 | 贡献) (→使用示例) |
||
第79行: | 第79行: | ||
<pre> | <pre> | ||
xml: | xml: | ||
− | http://api. | + | http://api.map.sina.com.cn/geocode/address_to_geo.xml?address=中关村&source=appkey |
json: | json: | ||
− | http://api. | + | http://api.map.sina.com.cn/geocode/address_to_geo.json?address=中关村&source=appkey |
</pre> | </pre> |
2011年3月23日 (三) 16:03的版本
目录 |
地理编码
根据地址返回坐标的接口
URL
http://api.map.sina.com.cn/geocode/address_to_geo.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
false
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
address | true | string | 需要获取坐标的地址 |
city | false | string | 所在城市对应代码 |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoSearchResult> <status>1</status> <geo> <exactitude>1.000000</exactitude> <name>中国北京市海淀区中关村</name> <longitude>116.324416</longitude> <latitude>39.984213</latitude> </geo> </geoSearchResult>
JSON示例
{ "status":1, "geo": { "exactitude":"1.000000", "name":"\u4e2d\u56fd\u5317\u4eac\u5e02\u6d77\u6dc0\u533a\u4e2d\u5173\u6751", "longitude":"116.324416", "latitude":"39.984213" } }
字段说明
- status:状态
- geo:geo信息
- exactitude:置信度
- name:匹配到的地址名称
- longitude:匹配到的坐标经度
- latitude:匹配到的坐标纬度
使用示例
xml: http://api.map.sina.com.cn/geocode/address_to_geo.xml?address=中关村&source=appkey json: http://api.map.sina.com.cn/geocode/address_to_geo.json?address=中关村&source=appkey