如何反向配对谷歌地图地址与lat,long在json格式



我知道如何用json格式的lac、ci params对谷歌地图进行反向配对,但我可以
找不到像这样用lat、long params进行解析的方法,这不可能吗
提前感谢。

尝试Google Geocoding API

由于您使用google-maps关键字对此进行了标记,因此您也可以直接从Google Maps中使用Geocoding API(例如Gmaps API V3):

    gmaps.geocoder.geocode({ 'address': address }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var marker = new google.maps.Marker({
                map: gmaps.map,
                position: results[0].geometry.location,
            });
            marker.setTitle(address);
            gmaps.bounds.extend(results[0].geometry.location);
            gmaps.map.fitBounds(gmaps.bounds);
            if(typeof(callback) === 'function') {
                callback(marker);
            }
        } else {
            console.log("Geocode was not successful for the following reason: " + status);
        }
    });

这个片段将获取地址的几何位置,并将其绘制在地图中(位于gmaps.map中)。它还将确保所有标记都在地图的范围内。

最新更新