import com.baidubce.http.ApiExplorerClient; import com.baidubce.http.AppSigner; import com.baidubce.http.HttpMethodName; import com.baidubce.model.ApiExplorerRequest; import com.baidubce.model.ApiExplorerResponse; // 逆地理编码 Java示例代码 public class RequestDemo { public static void main(String[] args) { String path = "https://jmregeocode.api.bdymkt.com/geocode/regeo/query"; ApiExplorerRequest request = new ApiExplorerRequest(HttpMethodName.POST, path); request.setCredentials("您的 access key", "您的 secret key"); request.addHeaderParameter("Content-Type", "application/json;charset=UTF-8"); request.addQueryParameter("location", ""); request.addQueryParameter("radius", ""); request.addQueryParameter("extensions", ""); request.addQueryParameter("batch", ""); request.addQueryParameter("roadlevel", ""); request.addQueryParameter("output", ""); request.addQueryParameter("homeorcorp", ""); request.addQueryParameter("callback", ""); request.addQueryParameter("poitype", ""); ApiExplorerClient client = new ApiExplorerClient(new AppSigner()); try { ApiExplorerResponse response = client.sendRequest(request); // 返回结果格式为Json字符串 System.out.println(response.getResult()); } catch (Exception e) { e.printStackTrace(); } } }
点击复制代码
{
"msg": "成功", //成功为200,其他为失败返回码(非http返回状态码)
"success": true,
"code": 200, //code对应的描述
"taskNo": "25247068960117401139", //唯一业务号
"data": {
"regeocodes": [{ //逆地理编码列表
"formatted_address": "浙江省杭州市萧山区盈丰街道顺发·美哉美城",//坐标地址
"addressComponent": {//地址元素列表
"country": "中国",//国家
"province": "浙江省",//坐标点所在省名称
"citycode": "0571",//城市编码
"city": "杭州市",//坐标点所在城市名称
"adcode": "330109",//行政区编码
"towncode": "330109015000",//乡镇街道编码
"district": "萧山区",//坐标点所在区
"township": "盈丰街道",//坐标点所在乡镇/街道
"seaArea": "所属海域信息",//所属海域信息
"neighborhood": {//社区信息列表
"name": [],//社区名称
"type": []//POI类型
},
"building": {//楼信息列表
"name": [],//建筑名称
"type": []//类型
},
"streetNumber": {//门牌信息列表
"number": "281号",//门牌号
"distance": "52.8425",//门牌地址到请求坐标的距离
"street": "民和路",//街道名称
"location": "120.257076,30.224231",//坐标点 经度,纬度
"direction": "东"//方向
},
"businessAreas": [//经纬度所属商圈列表
{
"businessArea":"",//商圈信息
"name": "宁围",//商圈名称
"location": "120.273765,30.225767",//商圈中心点经纬度 经度,纬度
"id": "330109"//商圈所在区域的adcode
}
],
"roads": [//道路信息列表 请求参数 extensions 为 all 时返回
{
"id": "",//道路id
"name": "",//道路名称
"distance": "",//道路到请求坐标的距离 米
"direction": "",//方位
"location": ""//坐标点 经度,纬度
}
],
"roadinters": [//道路交叉口列表 请求参数 extensions 为 all 时返回
{
"distance": "",//交叉路口到请求坐标的距离 米
"direction": "",//方位
"location": "",//路口经纬度 经度,纬度
"first_id": "",//第一条道路名称
"first_name": "",//第二条道路id
"second_id": "",//第二条道路名称
"second_name": ""//第二条道路id
}
],
"pois":[//poi信息列表
{
"id": "",//poi的id
"name": "",//poi点名称
"type": "",//poi类型
"tel": "",//电话
"distance": "",//该POI的中心点到请求坐标的距离 米
"direction": "",//方向
"address": "",//poi地址信息
"location": "",//坐标点 经度,纬度
"businessarea": ""//poi所在商圈名称
}
],
"aois":[//aoi信息列表
{
"id": "",//aoi的id
"name": "",//aoi点名称
"adcode": "",//所属 aoi 所在区域编码
"location": "",//所属 aoi 中心点坐标 经度,纬度
"area": "",//所属aoi点面积
"distance": ""//输入经纬度是否在aoi面之中
}
]
}
}]
}
}
{
"msg": "参数不正确",
"code": 400
}
1,官方直连,权威校验;2,全实时优质接口,不参缓存,品质保证;3,多通道冗余切换,稳定可靠