【问题标题】:How to convert postcode to Geolocation (latitude & longitude) using google maps api?如何使用谷歌地图 api 将邮政编码转换为地理位置(纬度和经度)?
【发布时间】:2011-10-27 21:39:19
【问题描述】:

我只想使用带有 Google 地图 API 的邮政编码来获取纬度和经度。

我正在使用 PHP 进行开发。

我该怎么做?

邮政编码可以来自世界上任何地方。

【问题讨论】:

标签: php google-maps google-maps-api-3 geolocation


【解决方案1】:

您可以使用谷歌地图地理编码 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);
?>

【讨论】:

  • 我需要一个非常具体的东西,我相信它经常被查到https://maps.googleapis.com/maps/api/geocode/json?address=SW5+0RQ&amp;sensor=false&amp;components=country:UK
猜你喜欢
  • 2013-10-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-21
  • 1970-01-01
  • 2018-07-26
  • 2011-06-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多