Google Blogoscoped


Latitude Longitude on Google Maps?

Philipp Lenssen [PersonRank 10]

Monday, July 4, 2005
17 years ago

Does anyone know how I can get the latitude/ longitude values for a place I searched on on Google Maps?

Pierre S [PersonRank 10]

17 years ago #

just click on link this page and grab the first two values in the url.These are your coords.

Suramya Tomar [PersonRank 1]

17 years ago #

Try using the following code (written in PHP).

function get_lat_long($q) {
   $gm = fopen('' .rawurlencode(str_replace('','+',$q)) . '&output=js','r');
   $tmp = @fread($gm,30000);
   $x = preg_replace ('/.*<point lat="([^"]*)" lng="([^"]*)".*/',
"|$1|$2|", nl2br(trim($tmp)));
   list ($dmy,$lat_value, $lng_value) = explode ("|",$x);

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

Forum home


Blog  |  Forum     more >> Archive | Feed | Google's blogs | About


This site unofficially covers Google™ and more with some rights reserved. Join our forum!