如何使用Google Maps API将邮政编码转换为地理位置(纬度和经度)?

14

我想使用Google地图API通过邮政编码获取经纬度。

我正在使用PHP进行开发。

我该怎么做?

这个邮政编码可以来自世界上任何地方。


http://stackoverflow.com/search?q=address+geolocation - Pekka
1个回答

21
你可以使用谷歌地图地理编码 API 来实现此功能。请参考以下示例,但要更正纬度/经度和地址,您需要传递完整的地址和邮政编码。
更多详细信息,请单击下面的链接:

http://code.google.com/apis/maps/documentation/geocoding/

<?php
$url ="http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false";
$result = simplexml_load_file($url);
print"<pre>";
print_r($result);
?>

1
我需要一个非常具体的东西,我毫不怀疑经常会查找 https://maps.googleapis.com/maps/api/geocode/json?address=SW5+0RQ&sensor=false&components=country:UK - Gajus

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接