Leaflet将坐标转换为街道地址

6

我正在创建一个应用程序,在其中使用Leaflet地图。我想知道是否有任何外部库可用于将坐标转换为街道地址?我正在使用Angular 6。

2个回答

18

使用Nominatim是一种非常简单的方法,它是由OpenStreetmap使用的工具。以下链接详细介绍了此工具:https://wiki.openstreetmap.org/wiki/Nominatim

这里有一个示例,说明如何使用它:

$.get('https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=47.217954&lon=-1.552918', function(data){
    console.log(data.address.road);
});

您只需要像这样用变量替换坐标即可:

lat='+ latitude +'

如果您需要插件: https://esri.github.io/esri-leaflet/examples/reverse-geocoding.html


3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接