function geo_flickr_reverse_geocode($lat, $lon) { $short_lat = (double) sprintf("%.3f", $lat); $short_lon = (double) sprintf("%.3f", $lon); $geohash = geohash_encode($short_lat, $short_lon); $cache_key = "flickr_reversegeocode_{$geohash}"; $cache = cache_get($cache_key); if ($cache['ok']) { return $cache['data']; } $args = array('lat' => $short_lat, 'lon' => $short_lon); $rsp = flickr_api_call('flickr.places.findByLatLon', $args); if (!$rsp['ok']) { return; } $loc = $rsp['rsp']['places']['place'][0]; cache_set($cache_key, $loc, 'set locally'); return $loc; }
function _reverse_geoplanet_shorten($lat, $lon) { $short_lat = (double) sprintf("%.3f", $lat); $short_lon = (double) sprintf("%.3f", $lon); $geohash = geohash_encode($short_lat, $short_lon); return array($short_lat, $short_lon, $geohash); }