如何在谷歌地图中从纬度和经度获取地址位置?

时间:2022-08-22 10:28:08

So I have latitude and longitude Like 44.4647452 and 7.3553838. I need to get address like: Milan, Italy, str. Kennedy 89.

所以我有纬度和经度,比如44.4647452和7.3553838。我需要得到这样的地址:米兰,意大利,肯尼迪89号。

How I can do it?

我该怎么做?

3 个解决方案

#1


134  

simply try to pass your lat and long to the following query string, and you will get a json array, fetch your city from there

只要尝试将您的lat和long传递到以下查询字符串,您就会得到一个json数组,从那里取回您的城市。

http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452,7.3553838&sensor=true

http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452 7.3553838传感器= true

#2


15  

What your looking for is Reverse Geo Coding. Have a look at this example here. https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

您需要的是反向地理编码。请看这个例子。https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

#3


7  

You have to make one ajax call to get the required result, in this case you can use Google API to get the same

您必须进行一个ajax调用才能得到所需的结果,在这种情况下,您可以使用谷歌API来获得相同的结果。

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true/false

Build this kind of url and replace the lat long with the one you want to. do the call and response will be in JSON, parse the JSON and you will get the complete address up to street level

构建这种url并将lat long替换为您想要的url。调用和响应将是JSON,解析JSON,然后您将得到完整的地址到街道级别

#1


134  

simply try to pass your lat and long to the following query string, and you will get a json array, fetch your city from there

只要尝试将您的lat和long传递到以下查询字符串,您就会得到一个json数组,从那里取回您的城市。

http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452,7.3553838&sensor=true

http://maps.googleapis.com/maps/api/geocode/json?latlng=44.4647452 7.3553838传感器= true

#2


15  

What your looking for is Reverse Geo Coding. Have a look at this example here. https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

您需要的是反向地理编码。请看这个例子。https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse

#3


7  

You have to make one ajax call to get the required result, in this case you can use Google API to get the same

您必须进行一个ajax调用才能得到所需的结果,在这种情况下,您可以使用谷歌API来获得相同的结果。

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true/false

Build this kind of url and replace the lat long with the one you want to. do the call and response will be in JSON, parse the JSON and you will get the complete address up to street level

构建这种url并将lat long替换为您想要的url。调用和响应将是JSON,解析JSON,然后您将得到完整的地址到街道级别