腾讯坐标拾取器: https://lbs.qq.com/getPoint/
高德地址参考: https://blog.csdn.net/pengxiaozhong/article/details/124013019
1.先去高德官网 实名认证然后创建应用,添加web服务
2.根据api获取经纬度
package com.smart.community.manage.property.controller; import com.alibaba.fastjson.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; /** * https://lbs.amap.com/api/webservice/guide/api/search * 坐标转换: https://lbs.amap.com/api/webservice/guide/api/convert */ public class AddressUntils { //这里添加应用的时候记得要使用windows平台的不要获取小程序或其他的否则会报错 private static final String key = "e6933547b77e92bbd7xxx1afXXxxx";//key值我用的是高德的key public static void main(String[] args) { String add = getAdd("114.123565", "22.695008"); JSONObject jsonObject = JSONObject.parseObject(add); JSONObject json = jsonObject.getJSONObject("regeocode"); String address = json.getString("formatted_address"); String infocode = jsonObject.getString("infocode"); System.out.println(address); System.out.println(add); } /** * @param lng * @param lat * @return */ public static String getAdd(String lng, String lat) { String urlString = "http://restapi.amap.com/v3/geocode/regeo?key=" + key + "&location=" + lng + "," + lat; String res = ""; BufferedReader in = null; try { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); String line = null; while ((line = in.readLine()) != null) { res += line + "\n"; } } catch (Exception e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } return res; } }