2012-01-31 109 views

回答

2

你可以检查出雅虎PlaceFinder API

这里有一个例子URL http://where.yahooapis.com/geocode?q=BL12DD&appid=[yourappidhere]

我以前用过这个,发现它有点准确。

文档:http://developer.yahoo.com/geo/placefinder/

继承人来代码

<?php 

    $data = fetchPage("http://where.yahooapis.com/geocode?q=BL12DD&appid=%5Byourappidhere%5D&flags=J"); 
    $yahooData = json_decode($data); 

    echo '<pre>'.print_r($yahooData, true).'</pre>'; 

    echo '<br />Lat: ' . $yahooData->ResultSet->Results[0]->latitude; 

    function fetchPage($url){ 
     $ch = curl_init(); 
     curl_setopt($ch, CURLOPT_URL, $url); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 
     $result = curl_exec($ch); 
     curl_close($ch); 
     return $result; 
    } 

?> 
+0

您的链接提供了准确性,如何准确我用我的php脚本绑定它,雅虎是否有一个页面? – 2012-01-31 14:51:40

+1

对不起,没有意识到大写字母是在大声笑 – 2012-01-31 14:51:57

+1

我用一些代码更新了答案。希望有所帮助。 – 2012-01-31 15:02:14

5

这里是所有英国邮政编码经度和纬度可下载的数据库。

http://wikileaks.org/wiki/UK_government_database_of_all_1,841,177_post_codes_together_with_precise_geographic_coordinates_and_other_information,_8_Jul_2009

这里是教程一步一步的地理编码英国邮政编码与谷歌地图API

http://www.tomanthony.co.uk/blog/geocoding-uk-postcodes-with-google-map-api/

+3

而不是使用这个维基解密(就好像它是“下柜”一些非法和)为什么不直接使用军械调查打开CodePoint数据集 - https://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html - 并且它比wikileaks 2009的更新更新 – 2012-01-31 14:46:45

3
邮政编码的

地形测量局的公开码点数据集为您提供所有英国大陆邮政编码的数据集

https://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html 

然后将这些转化成WGS84纬/长使用类似的图书馆

http://www.jstott.me.uk/phpcoord/ 
5

现在有一个免费的英国政府替代这里列出的其他选项。去http://postcodes.io/看到API的细节和例子

+0

谢谢你:) – 2014-03-20 17:33:02

+0

这一个是非常容易使用和免费的! – 2016-04-25 14:43:14

0

虽然这已经回答了: 这里是容许单或合并英国邮政代码(例如获得以GeoJSON为googlemaps..query一个简单的API的链接。 ZE1 0AE),部门,区,市和沃兹边界

https://www.mashape.com/vanitysoft/uk-boundaries-io

​​