我想从 GPS 坐标中获取城市名称。 我可以使用 Google 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®ion=gb
向我返回坐标的 XML 详细信息....我认为很难获得城市的名称.... 我只想要城市的名字。。 提前感谢您的帮助
最佳答案
正确的网址如下
http://maps.googleapis.com/maps/api/geocode/xml?latlng=53.244921,-2.479539&sensor=true
无论如何,获取城市的 xml 是完全可以的。在这种情况下
<address_component>
<long_name>Northwich</long_name>
<short_name>Northwich</short_name>
<type>postal_town</type>
</address_component>
是您正在寻找的。 不确定您希望从哪种语言中获取此信息。 从您使用 javascript 的其他问题来看。 所以我建议学习如何使用 javascript 解析 XML。
SO 在 here 上有一篇很棒的帖子
关于gps - 从 GPS 坐标中获取城市名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10913870/