【问题标题】:Leaflet translate coordinates into street addresses传单将坐标转换为街道地址
【发布时间】:2018-08-06 07:18:23
【问题描述】:

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

【问题讨论】:

    标签: javascript angular typescript leaflet maps


    【解决方案1】:

    这是使用 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

    【讨论】:

      【解决方案2】:

      您要求的内容称为Geocoding。对于 Leaflet,有很多插件可以实现这一点,所有插件都列在 https://leafletjs.com/plugins#geocoding 中。请注意,某些插件(例如 https://github.com/perliedman/leaflet-control-geocoder)不限于一个地理编码提供程序。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多