从GPS坐标获取城市名称(Get City name from GPS co-ordinates)

2019-07-29 18:08发布

我想这个城市从GPS坐标的名称。 我可以使用谷歌API获取GPS点的细节

http://maps.googleapis.com/maps/api/geocode/output?parameters

当输出为XML,我不希望是...例如

http://maps.google.com/maps/api/geocode/xmllatlng=53.244921,-2.479539&sensor=false&region=gb

返回我的坐标XML细节....我不认为这是容易得到的城市的名称....我想这个城市的唯一名字..感谢您提前帮助

Answer 1:

正确的URL是低于

http://maps.googleapis.com/maps/api/geocode/xml?latlng=53.244921,-2.479539&sensor=true

在anycase中,XML是完全没有得到一个城市。 在这种情况下

<address_component>
    <long_name>Northwich</long_name>
    <short_name>Northwich</short_name>
    <type>postal_town</type>
</address_component>

是你在找什么。 不知道你是希望在虽然得到这个信息的语言。 从您的其他问题,看起来你用JavaScript工作。 因此,我建议学习如何将XML与JavaScript解析。

所以一直对这个伟大的职位在这里



文章来源: Get City name from GPS co-ordinates