传媒公司商业计划书青岛seo杭州厂商
一、什么是地理编码/经纬度解析/经纬度地址转换接口?
根据经、纬度信息查询地理位置信息及附近周边的地理信息。也可将地址转换为经纬度坐标,且支持对地标性名胜景区、建筑物名称解析为经纬度坐标,数据基于火星坐标系。实时返回结果,支持高并发,高效准确。
二、如何对接该接口?
下面我们以阿里云接口为例,具体Java示例代码如下:
接口地址:https://market.aliyun.com/apimarket/detail/cmapi00069996?#sku=yuncode6399600002 public static void main(String[] args) {String host = "https://kzgeocode.market.alicloudapi.com";String path = "/api/geo/reserve_get";String method = "POST";String appcode = "你自己的AppCode";Map<String, String> headers = new HashMap<String, String>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105headers.put("Authorization", "APPCODE " + appcode);//根据API的要求,定义相对应的Content-Typeheaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");Map<String, String> querys = new HashMap<String, String>();Map<String, String> bodys = new HashMap<String, String>();bodys.put("points", "117.125534,31.839601");bodys.put("radius", "100");bodys.put("pageSize", "10");bodys.put("currentPage", "1");try {/*** 重要提示如下:* HttpUtils请从* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java* 下载** 相应的依赖请参照* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml*/HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);System.out.println(response.toString());//获取response的body//System.out.println(EntityUtils.toString(response.getEntity()));} catch (Exception e) {e.printStackTrace();}}
成功返回示例如下:
{"msg": "成功","success": true,"code": 200,"data": {"total": 10,//返回数据条数"rows": [{"address": "彩虹路与石莲路交叉口西南200米",//匹配到的地址名称"code": "340104",//地址数据编码"distanceCalculation": 268.27,//距中心点距离"lng": 117.12765802724438,//地址经度"city": "合肥市",//数据所在市"fullMath": false,//完全匹配 true,不完全匹配 false"county": "蜀山区",//数据所在区"srcLat": 31.839601,//"srcLng": 117.125534,"province": "安徽省",//数据所在省"similarity": 0.0,"geoId": "262922252",//数据入库唯一编码"geomtype": "1",数据空间类型(1点/2线/3面/4点面/5点线)"name": "合肥市科技馆蜀西湖馆区",//匹配到的地名名称"statusName": "已完成","geometry": {//数据空间信息"coordinates": [117.1220334946699,31.843049325804635],"type": "Point"},"id": "u3FFF5QBSKyiJEnrE6IU","poiId": "609829316","lat": 31.841207728836324,"status": 3}]}
}