Flickr just released their huge Geodata update both on their website and in their API. The API lacks just one thing that their website has. You can't get at the friendly little bit of text that says "in New York, NY" or "near Metropolis, IL" via the API. To help people with this, I've parsed a huge set of census data to find out where thirty thousand towns in the United States are located so that I can give you access to that same data (which is more accurate for me, at least, than Flickr's version).

I've found some useful data for countries outside of the United States. I'll be inputting them as I can. If you have any specific requests for countries, let me know. Note: I don't have the land area data with other countries that I do with the United States, so it won't be able to tell whether a photo is taken inside a given town.

Supported Countries

Caveats

  1. I don't know how many people are going to want to use this. If it starts to overload my server or use up to much bandwidth, I'll have to start limiting API calls by IP Address if I see some people hitting it too often. Alternatively, if I had some people donate money (see the link below), I could upgrade my server to make it more stable and more capable to handle the load.
  2. This won't be 100% accurate. I'm not going to give any warranty that if you geotag a photo on the edge of a town that it won't say that it's "near" the town. If you notice any towns that are titled incorrectly, you can contact me on my website

Instructions

  1. For the end point, use http://phpflickr.com/geodata/
  2. Pass the following variables as either POST or GET variables:
    • lat: Latitude for the lookup
    • lon: Longitude for the lookup
    • format: This one is optional. You can pass php, json, plaintext, or xml. If you pass no format variable, it'll return the XML format by default.
    • showCountry: Also optional. If you pass a value of 1, the service will return the name of the country that the place is located in.
  3. That's it! Just check out the results. By the way... "distance" is the distance from the town center in meters and the "radius" is the distance in meters that determines whether a position is inside the town or outside it.
  4. Example Call

Related Links