Reputation: 800
I am using google maps v3, Currently it is working fine, if i pass the latitude and longitude in 'position'. But, I need to pass address instead of latitude and longitude.
var ll = new google.maps.LatLng(dat_values[i].lat, dat_values[i].lng);
var marker = new google.maps.Marker({
position: ll,
icon: myImage,
shadow: myShadow,
});
Kindly anyone suggest.
thanks,
Upvotes: 3
Views: 4462
Reputation: 31
Here's another similar approach:
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address=573/1,+Jangli+Maharaj+Road,+Deccan+Gymkhana,+Pune,+Maharashtra,+India&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
From: http://amiworks.co.in/talk/how-to-get-latitudelongitude-from-an-address-or-geocoding-using-php/
Upvotes: 3
Reputation: 31922
You've have to use the Geocoder service to convert the address into a LatLng.
Upvotes: 1