如何使用谷歌地图API将邮政编码转换为地理位置(纬度和longitutde)? [英] How to convert postcode to Geolocation(latitude & longitutde) using google maps api?
问题描述
我使用PHP进行开发。
我怎么能这样做?邮政编码可以来自任何地方。
您可以使用Google地图Geocoding API执行此操作。请查看下面的示例,但要更正纬度/经度和地址,您需要将完整地址和邮政编码一起传递。
更多详情,请点击以下链接:
http://code.google.com/apis/maps / documentation / geocoding /
<?php
$ url =http:// maps ?.googleapis.com /地图/ API /地理编码/ xml的地址= 1600 + +剧场大道,+山+视图,+ CA&安培;传感器=假;
$ result = simplexml_load_file($ url);
打印< pre>;
print_r($ result);
?>
i Just want to get latitude & longitude using the post code with Google maps API.
I am using PHP for development.
So please suggest me how can i do this ?
The post code can be from any where in this world.
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);
?>
这篇关于如何使用谷歌地图API将邮政编码转换为地理位置(纬度和longitutde)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!