zoukankan      html  css  js  c++  java
  • 用高德地图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 {
            }

  • 相关阅读:
    浏览器驱动
    django中的cookie和session
    django自定义中间件实现登陆
    django虚拟环境与文件上传
    了解和熟悉数据库相关知识
    JMeter ---相关脚本笔记
    JMeter脚本---关于时间戳的处理笔记
    JMeter中的读取json数据---JSON Extractor插件
    更多API知识学习
    认识VIM编辑器
  • 原文地址:https://www.cnblogs.com/exmyth/p/4423769.html
Copyright © 2011-2022 走看看