Geocode/address to geo
Zhangchao2 (讨论 | 贡献) |
Zhangchao2 (讨论 | 贡献) (→地理编码) |
||
第1行: | 第1行: | ||
− | == ''' | + | == '''geocode/address_to_geo''' == |
根据地址返回坐标的接口 | 根据地址返回坐标的接口 | ||
2011年5月7日 (六) 00:21的版本
目录 |
geocode/address_to_geo
根据地址返回坐标的接口
URL
http://api.t.sina.com.cn/location/geocode/address_to_geo.(json%7Cxml)
支持格式
XML/JSON
HTTP请求方式
GET
是否需要登录
true
请求数限制
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份 |
address | true | string | 需要获取坐标的地址 |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoResult> <status>1</status> <geo> <exactitude>1.000000</exactitude> <name>中国北京市海淀区中关村</name> <longitude>116.324416</longitude> <latitude>39.984213</latitude> </geo> </geoResult> === '''JSON示例''' === <pre> { "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:匹配到的坐标纬度
使用示例
注:中文需进行urlencode编码
xml: curl -u "username:password" "http://api.t.sina.com.cn/location/geocode/address_to_geo.xml?address=%E4%B8%AD%E5%85%B3%E6%9D%91&source=appkey" json: curl -u "username:password" "http://api.t.sina.com.cn/location/geocode/address_to_geo.json?address=%E4%B8%AD%E5%85%B3%E6%9D%91&source=appkey"