开发者

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

开发者 https://www.devze.com 2023-03-15 19:41 出处:网络
i know how to do开发者_开发百科 reverse paring google map with lac, ci params in a json format, but i can

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.


Try The Google Geocoding API


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消