Does anyone know how I can get the latitude/ longitude values for a place I searched on on Google Maps? |
just click on link this page and grab the first two values in the url.These are your coords. |
Try using the following code (written in PHP).
function get_lat_long($q) { $gm = fopen('http://maps.google.com/maps?q=' .rawurlencode(str_replace('','+',$q)) . '&output=js','r'); $tmp = @fread($gm,30000); fclose($gm); $x = preg_replace ('/.*<point lat="([^"]*)" lng="([^"]*)".*/', "|$1|$2|", nl2br(trim($tmp))); list ($dmy,$lat_value, $lng_value) = explode ("|",$x); return(array('latitude'=>$lat_value,'longitude'=>$lng_value)); }
and then call it using:
$tmp = get_lat_long($address_string);
Where the address string is the address you searched for. Hope this helps.
- Suramya |