简体   繁体   中英

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
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):

    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). It'll also make sure that all markers fit within the bounds of the map.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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