[英]Send request to google maps api
when I get the coordinates, I need send request like this: 当我得到坐标时,我需要像这样发送请求:
http://maps.googleapis.com/maps/api/geocode/json?latlng=55.75320193022759,37.61922086773683&sensor=false&language=ru
, but how i can send this in JavaScript? ,但是我如何用JavaScript发送呢?
If you are using the Google Maps API v3 use the geocoding service 如果您使用的是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);
}
});
See: https://developers.google.com/maps/documentation/javascript/geocoding 请参阅: https : //developers.google.com/maps/documentation/javascript/geocoding
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.