簡體   English   中英

將地址轉換為經度/緯度(使用php)

[英]Convert Address to Latitude/longitude (using php)

我想用PHP解析此URL,以獲取特定地址的緯度(2 + bis + avenue + Foch75116 + Paris + FR):

我使用了Google Maps Web服務: http : //maps.googleapis.com/maps/api/geocode/json?address=2+bis+avenue+Foch75116+Paris+FR&sensor=false

// Get the JSON 
$url='http://maps.googleapis.com/maps/api/geocode/json?address=2+bis+avenue+Foch75116+Paris+FR&sensor=false';
$source = file_get_contents($url);
$obj = json_decode($source);
var_dump($obj);

沒用 我有這個錯誤:

OVER_QUERY_LIMIT

因此,我在網上進行搜索,發現使用Google Maps api有一個限制(每天2次查詢之間至少需要1秒,每天最多2500個查詢之間)

您知道將地址轉換為->緯度/經度的任何方法嗎?

您錯誤地訪問results

// Get the JSON 
$url='http://maps.googleapis.com/maps/api/geocode/json?address=2+bis+avenue+Foch75116+Paris+FR&sensor=false';
$source = file_get_contents($url);
$obj = json_decode($source);
$LATITUDE = $obj->results[0]->geometry->location->lat;
echo $LATITUDE;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM