100分 |
给你找了一下官网API
地址:http://lbs.amap.com/yuntu/reference/cloudsearch/ 请求示例: http://yuntuapi.amap.com/datasearch/local?tableid=52b155b6e4b0bc61deeb7629&city=北京市&keywords= &filter=type:写字楼&limit=50&page=1&key=<用户key> //搜索存储在云图数据表中的北京市的写字楼,返回第一页数据 示例返回结果: { "info": "OK", "status": 1, "count": 2, "datas": [ { "_id": "295", "_name": "方恒国际", "_location": "116.481471, 39.990471", "_address": "北京市朝阳区阜通东大街18号", "star": 4, "rent":7.5, "_createtime": "2013-12-19 17:23:44", "_updatetime": "2013-12-19 17:23:44", }, { "_id": "355", "_name": "国际竹藤大厦", "_location": "116.479894, 39.988999 ", "_address": "北京市朝阳区望京阜通东大街8号", "star": 4, "rent":7, "_createtime": "2013-12-19 17:19:05", "_updatetime": "2013-12-19 17:19:05", ] } |
String addressStr = “http://restapi.amap.com/v3/geocode/geo?key=9a491a13997579f985c98165bb68d127&s=rsv3&city=028&address=”;
String getAddress = HttpUtils.get(addressStr + UrlEncoded.encodeString(address)); JSONObject object = JSONObject.parseObject(getAddress); JSONArray geocodes = object.getJSONArray(“geocodes”); ExcelDetails details = ExcelDetails.dao.findById(id); if (geocodes.size() == 0) { details.set(“status”, 0); } else if (geocodes.size() == 1) { JSONObject trueAddress = geocodes.getJSONObject(0); String location = trueAddress.getString(“location”); String lngX = location.split(“,”)[0]; String latY = location.split(“,”)[1]; } else { } |