Sunday 21 August 2016

how to get latitude and longitude from Address .

$address = 'sector 70 mohali';

$geo = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.urlencode($address).'&sensor=false');

$geo = json_decode($geo, true);

if ($geo['status'] == 'OK') {
 $latitude = $geo['results'][0]['geometry']['location']['lat'];
 $longitude = $geo['results'][0]['geometry']['location']['lng'];
}

No comments:

Post a Comment