逆地理编码Web API,根据经伟度坐标获取地址、周边POI

Demo说明:

根据输入的经伟度坐标,查询获取对应所在地址位置;可通过该功能,将结构化地址(省/市/区/街道/门牌号)解析为对应的位置坐标,逆地理编码服务提供将坐标点(经纬度)转换为对应位置信息(如所在行政区划,周边地标点分布)功能,服务同时支持全球行政区划位置描述及周边地标POI数据等。

逆地理编码:

逆(反向)地理编码是将点位置(纬度、经度)反向编码为可读地址或地名的过程。这允许识别附近的街道地址,地点和/或区域细分,例如社区、县、州或国家。与地理编码和路由服务相结合,反向地理编码是基于移动位置的服务的关键组成部分,可将GPS获得的坐标转换为可读的街道地址,最终用户更易于理解。

地址结构越完整,地址内容越准确,解析的坐标精度越高!!!

API效果图:

 

效果预览:

Demo:

https://demo.muguilin.com/根据经伟度坐标获取地址

源码地址:

GitHub:GitHub - MuGuiLin/Reverse-Geo-Coding: 根据输入的经伟度坐标,查询获取对应所在地址位置;用户可通过该功能,将结构化地址(省/市/区/街道/门牌号)解析为对应的位置坐标。地址结构越完整,地址内容越准确,解析的坐标精度越高。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
可以使用Haversine公式来计算经纬度之间的距离,然后从给定经纬度坐标附近的地点列表中找到最近的地点。 以下是Java实现的示例代码: ```java import java.util.*; public class GeoLocation { private static final int EARTH_RADIUS = 6371; // 地球半径,单位:公里 private final double latitude; private final double longitude; public GeoLocation(double latitude, double longitude) { this.latitude = latitude; this.longitude = longitude; } public double getLatitude() { return latitude; } public double getLongitude() { return longitude; } // 计算两个经纬度坐标之间的距离,单位:公里 public double distanceTo(GeoLocation other) { double lat1 = Math.toRadians(latitude); double lon1 = Math.toRadians(longitude); double lat2 = Math.toRadians(other.latitude); double lon2 = Math.toRadians(other.longitude); double dlat = lat2 - lat1; double dlon = lon2 - lon1; double a = Math.sin(dlat/2) * Math.sin(dlat/2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dlon/2) * Math.sin(dlon/2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); return EARTH_RADIUS * c; } // 返回给定经纬度附近的地点列表,可以从数据库或API获取 public static List<GeoLocation> getNearbyLocations(GeoLocation location) { List<GeoLocation> locations = new ArrayList<>(); // TODO: 从数据库或API获取经纬度坐标列表,并添加到locations中 return locations; } // 返回给定经纬度附近最近的地点 public static GeoLocation getNearestLocation(GeoLocation location) { List<GeoLocation> locations = getNearbyLocations(location); GeoLocation nearestLocation = null; double minDistance = Double.MAX_VALUE; for (GeoLocation loc : locations) { double distance = location.distanceTo(loc); if (distance < minDistance) { minDistance = distance; nearestLocation = loc; } } return nearestLocation; } } ``` 使用示例: ```java GeoLocation myLocation = new GeoLocation(31.2233, 121.4554); GeoLocation nearestLocation = GeoLocation.getNearestLocation(myLocation); System.out.println("Nearest location: " + nearestLocation.getLatitude() + ", " + nearestLocation.getLongitude()); ``` 注意:此示例代码仅用于演示目的,实际应用中需要从数据库或API获取地点列表。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值