繁体   English   中英

如何用lat格式的经纬度反向解析google map地址?

[英]how to reverse paring google map address with lat,long in json format?

我知道如何用json格式的lac,ci params反向解析google map,但是我可以
找不到这样的方法用经纬度较长的参数进行解析,这是不可能的吗?
谢谢提前。

由于您是用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中)。 它还将确保所有标记都在地图范围内。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM