腾讯坐标拾取器: 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; } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
2020-02-22 深度克隆工具类