I am using this php-code to find LAT/LNG for a city: (Note: it may be better to use the ISO-code instead of country name, in the example +NO instead of +Norway)
$googleHttp="http://maps.google.com/maps/api/geocode/json?address=Oslo, +Norway"; $googleArray = file($googleHttp); $elementNos=count($googleArray); // Check if LAT/LNG is found: if (strchr(ltrim($googleArray[1]),'"status": "OK",')) { $latitude="0"; // Assume not found... $longitude="0"; $ix=0; while ($elementNos > $ix) { $line=ltrim($googleArray[$ix]); // Whitespace $line=rtrim($line); // Whitespace if (substr($line,1,3)=="lat") $latitude=substr($line,7,13); if (substr($line,1,3)=="lng") { $longitude=substr($line,7,13); $ix=$elementNos; // Forced break... } $ix=$ix+1; } } } On Jul 2, 7:39 am, vishal rai <[email protected]> wrote: > Hi > > I have to integrate Google API in my site. > The requirement is once i get a country, i have to search all the city > of the selected country using Google API. > > This is urgent > Can you help me ASAP... -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
