简体   繁体   English

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

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

i know how to do reverse paring google map with lac, ci params in a json format, but i can 我知道如何用json格式的lac,ci params反向解析google map,但是我可以
not find the way like this do a parse with lat, long params, is it not possible? 找不到这样的方法用经纬度较长的参数进行解析,这是不可能的吗?
thanks advance. 谢谢提前。

Since you tagged this with the google-maps keyword, you can also the Geocoding API directly from within Google Maps (example is for Gmaps API V3): 由于您是用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);
        }
    });

This snippet will fetch the address' geometry location, and plots it in the map (which lives in gmaps.map). 该代码段将获取地址的几何位置,并将其绘制在地图中(该地址位于gmaps.map中)。 It'll also make sure that all markers fit within the bounds of the map. 它还将确保所有标记都在地图范围内。

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

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