我知道这在Javascript中是可能的,但我只需要使用PHP就可以了,我该怎么做?
发布于 2009-10-06 14:51:44
是的,有一个你可以从任何服务器语言调用的HTTP geocoding interface。
发布于 2011-06-12 17:06:31
和其他方式:
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
发布于 2009-10-06 15:00:24
使用Google Map API和PHP获取坐标:
$url = 'http://maps.google.com/maps/geo?q='.$address.'&output=json&oe=utf8&sensor=false&key='.$api_key;
$data = @file_get_contents($url);
$jsondata = json_decode($data,true);
if(is_array($jsondata )&& $jsondata ['Status']['code']==200){
$lat = $jsondata ['Placemark'][0]['Point']['coordinates'][0];
$lon = $jsondata ['Placemark'][0]['Point']['coordinates'][1];
}
https://stackoverflow.com/questions/1526057
复制相似问题