I’ve been playing a lot with Geocoding over the past few months and caius helped me put some code together that I think you might like (if you’ve come here from Google searching for reverse geocoding with the google maps api)
class ReverseGeocode{public static function get( $latitude, $longitude,$apikey ){$url = “http://maps.google.com/maps/geo?”;$url .= http_build_query(array(“oe” => “utf8″,”output” => “json”,”sensor” => “false”, “key” => $apikey)) . “&q={$latitude},{$longitude}”;$raw_data = file_get_contents($url);$data = json_decode($raw_data);return $data;}}class ReverseGeocode
{
public static function get( $latitude, $longitude,$apikey )
{
$url = “http://maps.google.com/maps/geo?”;
$url .= http_build_query(array(“oe” => “utf8″,”output” => “json”,”sensor” => “false”, “key” => $apikey)) . “&q={$latitude},{$longitude}”;
$raw_data = file_get_contents($url);
$data = json_decode($raw_data);
return $data;
}
}
Related posts:
- Google, are you taking the piss? Found on the Google Profile page.. Google has a...
- Google Showing “Skip Intro” Link? Am I missing something or has google always done this...
- The Google Curse? Google has a habit of buying companies and trashing them…...
And because I’m a complete code nazi (yes, even with PHP) I tidied it up over at http://gist.github.com/219157
It may even embed properly:
Or not.