用高德地圖API 通過詳細地址獲得經緯度


http://cloud.sinyway.com/Service/amap.html

 

 

http://restapi.amap.com/v3/geocode/geo?key=xxxxxxxxxxxxxxxx&s=rsv3&city=35&address=福建省霞浦縣水門畲族鄉

可用key=389880a06e3f893ea46036f030c94700測試

http://webapi.amap.com/maps?v=1.1&key=389880a06e3f893ea46036f030c94700

 

String addressStr = "http://restapi.amap.com/v3/geocode/geo?key=xxxxxxxxxxxxxxxx&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 {
        }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM