php百度地图根据地址获取经纬度

//PHP根据地理位置信息获取经纬度

$address = urlencode($data['province'].''.$data['city'].''.$data['distric'].''.$data['address']);

$url='http://api.map.baidu.com/geocoder/v2/?address='.$address.'&output=json&ak=ZdV0FOn1PItK3eGgbFH3MGAfvyBL1ThK';

$rs = file_get_contents($url);

$json_data = json_decode($rs);

$lng = $json_data->result->location->lng;

$lat = $json_data->result->location->lat;

$data['lat'] =$lat;

$data['log'] =$lng;


http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-geocoding

你可能感兴趣的:(php百度地图根据地址获取经纬度)