Geocode/address to geo
Zhangchao2 (讨论 | 贡献) |
Zhangchao2 (讨论 | 贡献) |
||
第3行: | 第3行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api. | + | http://api.t.sina.com.cn/location/geocode/address_to_geo.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第12行: | 第12行: | ||
== '''是否需要登录''' == | == '''是否需要登录''' == | ||
− | ''' | + | '''true''' |
== '''请求数限制''' == | == '''请求数限制''' == | ||
'''true''' | '''true''' | ||
第30行: | 第30行: | ||
| style="text-align:center;" |true | | style="text-align:center;" |true | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | 需要获取坐标的地址 | + | | 需要获取坐标的地址 |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|} | |} | ||
第43行: | 第38行: | ||
<pre> | <pre> | ||
<?xml version="1.0" encoding="UTF-8" ?> | <?xml version="1.0" encoding="UTF-8" ?> | ||
− | < | + | <geoResult> |
<status>1</status> | <status>1</status> | ||
<geo> | <geo> | ||
第51行: | 第46行: | ||
<latitude>39.984213</latitude> | <latitude>39.984213</latitude> | ||
</geo> | </geo> | ||
− | </ | + | </geoResult> |
− | + | ||
=== '''JSON示例''' === | === '''JSON示例''' === | ||
第71行: | 第65行: | ||
:status:状态 | :status:状态 | ||
:geo:geo信息 | :geo:geo信息 | ||
− | :: | + | ::exactitude:置信度(可能为空) |
− | + | ::name:匹配到的地址名称 | |
− | + | ::longitude:匹配到的坐标经度 | |
− | + | ::latitude:匹配到的坐标纬度 | |
== '''使用示例''' == | == '''使用示例''' == | ||
+ | 注:中文需进行urlencode编码 | ||
<pre> | <pre> | ||
xml: | xml: | ||
− | http://api. | + | 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: | json: | ||
− | http://api. | + | 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" |
</pre> | </pre> |
2011年5月6日 (五) 23:55的版本
目录 |
地理编码
根据地址返回坐标的接口
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"