2012-01-31 190 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

​​

相關問題