如何将邮政编码转换为地理位置(纬度&经度)使用谷歌地图api


How to convert postcode to Geolocation (latitude & longitude) using google maps api?

我只想得到纬度&使用Google maps API使用邮政编码查找经度。

我正在使用PHP进行开发。

我该怎么做?

邮编可以来自世界上任何地方

您可以使用google map Geocoding 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);
?>