如何使用谷歌地图API将邮政编码转换为地理位置(纬度和longitutde)? [英] How to convert postcode to Geolocation(latitude & longitutde) using google maps api?

查看:319
本文介绍了如何使用谷歌地图API将邮政编码转换为地理位置(纬度和longitutde)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想得到纬度&经度使用谷歌地图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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆