reverse-geoplanet is a simple web application to reverse geocode a latitude and longitude using the Flickr reverse geocoder.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


reverse-geoplanet is a simple web application to reverse geocode a latitude and longitude using the Flickr reverse geocoder. Results include both the primary Where On Earth (WOE) ID for the lat,lon and a truncated hierarchy of parent WOE IDs. Results are cached in both a MySQL instance local to the application as well as Memcache, if it is installed.

reverse-geoplanet was originally developed for the building=yes project.

You will need a valid Flickr API key in order to use reverse-geoplanet.

Installing reverse-geoplanet

Please consult the document.

How to,-122.419787

	"name":"Mission Dolores, San Francisco, CA, US, United States",

Do you see the part where the name attribute contains the country name twice? The part where it says "Mission Dolores, San Francisco, CA, US, United States"? That's actually I bug that I am responsible for from back, so many moons ago, when I still worked at Flickr. I'm sorry. It hurts every time I see it...

By default reverse-geoplanet outputs JSON and is expected to be run more as a service for other robots rather than a website for humans. You can force results to be returned as HTML by specifying the inline=1 argument. For example:


You can also call the reverse geocoder directly from a Flamework project like this:


$lat = 40.721294;
$lon = -73.983994;
$remote = '';

dumper(reverse_geoplanet($lat, $lon));
dumper(reverse_geoplanet($lat, $lon, $remote));

The third argument is optional and tells the code to call another remote instance of reverse-geoplanet for results.

If you want to bolt the functionality in to another Flamework project itself you'll need to copy the following files:

(I should probably just write a shell script to automate this...)


There is a client-side Python library included that will call your instance of reverse-geoplanet and also cache the results locally using an in-memory SQLite database. In case you want to do reverse geocoding from your laptop or something. Like this:

$> cd python/reverse_geoplanet

$> python ''

	u'stat': u'ok',
	u'name': u'Ygnacio Valley, Concord, CA, US, United States',
	u'locality': u'2384020',
	u'woeid': u'55858555',
	u'region': u'2347563',
	u'created': u'1327172577',
	u'longitude': u'-122.022',
	u'placetype': u'22',
	u'geohash': u'9q9pxrf7',
	u'country': u'23424977',
	u'latitude': u'37.924'


reverse-geoplanet is built on top of Flamework which means if you're poking around the code you may be wondering what all that other stuff is for. At the moment: Nothing and it's all disabled. In the future, who knows?

See also