接口说明
将地址转换成坐标的功能,将详细的地址描述传给百度车联网服务如:北京市上地十街十号百度大厦,返回经纬度坐标。
接口示例
http://api.map.baidu.com/telematics/v3/geocoding?keyWord=北京市上地十街十号百度大厦&cityName=131&out_coord_type=gcj02&ak=E4805d16520de693a3fe707cdc962045
接口参数设置
参数类型
|
参数名称
|
是否必须
|
具体描述
|
String
|
ak
|
true
|
开发者密钥
|
String
|
sn
|
false
|
若用户所用ak的校验方式为sn校验时该参数必须。 (sn生成算法)
|
String
|
keyWord
|
true
|
搜索的具体地址,建议按照省市/区县/街道、POI名称的方式完整填写,例如:北京市/海淀区/上地信息路甲9号/奎科科技大厦
|
String
|
cityName
|
true
|
城市名称,如cityName=’北京’
|
String
|
output
|
false
|
输出的数据类型,默认为xml格式的数据,如果将output的值设置为“json”,则输出json格式的数据
|
String
|
out_coord_type
|
false
|
返回结果输出时的坐标类型,默认为gcj02经纬度坐标。允许的值为bd09ll、bd09mc、gcj02。bd09ll表示百度经纬度坐标,bd09mc表示百度墨卡托坐标,gcj02表示经过国测局加密的坐标。
|
String
|
callback
|
false
|
将json格式的返回值通过callback函数返回以实现jsonp功能。举例:callback=showLocation(JavaScript函数名)。
|
返回结果
参数类型
|
参数名及位置
|
具体描述
|
string
|
status
|
请求状态,包括success,required parameter,sever error等多种状态;
|
int
|
precise
|
精准度,0为不够精准,1表示比较精准
|
float
|
lng
|
地点的经度
|
float
|
lat
|
地点的纬度
|
返回xml格式的数据
<GecoderResponse>
<status>Success</status>
<results>
<result>
<location>
<lat>40.050743859593</lat>//当前点的经度坐标
<lng>116.3017193083</lng>//当前点对应的纬度坐标
</location>
<precise>1</precise>
</result>
</results>
</GecoderResponse>
返回json格式的数据
{
"status":"success",
"results":{
"location":{"lng":116.3017193083,"lat":40.050743859593},
"precise":1,
}
}