簡體   English   中英

向Google Maps API發送請求

[英]Send request to google maps api

當我得到坐標時,我需要像這樣發送請求:

http://maps.googleapis.com/maps/api/geocode/json?latlng=55.75320193022759,37.61922086773683&sensor=false&language=ru

,但是我如何用JavaScript發送呢?

如果您使用的是Google Maps API v3,請使用地理編碼服務

var geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(55.75320193022759, 37.61922086773683);

geocoder.geocode({'latLng': latlng}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        alert(results[1].formatted_address);
    } else {
        alert("Geocoder failed due to: " + status);
    }
});

請參閱: https : //developers.google.com/maps/documentation/javascript/geocoding

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM