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

不问归期 提交于 2019-12-03 05:11:29

问题


I just want to get latitude & longitude using the post code with Google maps API.

I am using PHP for development.

How can I do this?

The post code can be from any where in this world.


回答1:


You can do this using google map Geocoding API. Please find below example, but to correct latitude/longitude and address you need to pass full address along with zipcode.

For more detail please click on below link:

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);
?>


来源:https://stackoverflow.com/questions/7075912/how-to-convert-postcode-to-geolocation-latitude-longitude-using-google-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!