如何使用Google Maps API将邮政编码转换为Geolocation(纬度和经度)? [英] How to convert postcode to Geolocation (latitude & longitude) using google maps api?

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

问题描述

我只想获得纬度&邮政编码与Google Maps API一起使用经度.

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

我正在使用PHP进行开发.

I am using PHP for development.

我该怎么做?

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

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

推荐答案

您可以使用Google Map Geocoding API进行此操作.请找到以下示例,但是要更正纬度/经度和地址,您需要传递完整的地址以及邮政编码.

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

这篇关于如何使用Google Maps API将邮政编码转换为Geolocation(纬度和经度)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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