如何使用google maps api将邮政编码转换为地理位置(纬度和经度)?

Pee*_*ush 13 php google-maps geolocation google-maps-api-3

我只是想使用谷歌地图API的邮政编码获得经纬度.

我正在使用PHP进行开发.

我怎样才能做到这一点?

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

San*_*han 20

您可以使用Google地图地理编码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);
?>
Run Code Online (Sandbox Code Playgroud)