Roll up, roll up, roll up, get your WoE IDs here ...
... a jolly nice step in the right direction.
Yahoo have opened up their geo database (which is pretty good btw) which is far more awesome than I'm going to make it sound in this blog post. I already did a little bit back here. But a quick call out to these two functions that'll try and find you WoE IDs based on string input...
- Find the WOEID of a specific place
- Obtain a range of WOEIDs that match a given place, ordered by the most likely
... the first API call gives,
36240 as the value for Stoke on Trent in the UK, my old hometown. With that WoeID I can plug it back into these other API calls to get various useful information back ...
- Resolve a WOEID to a place
- Find the parent of a given WOEID (and return a detailed record)
- To obtain a list of geographies that neighbor a specific WOEID
We use WoE IDs over at Flickr, again you can read a little more about that near the end my terribly long previous blog posts about twitter, APIs and such like. A quick recap is that we have these WoE related APIs ...
And flickr.places.resolvePlaceId, if you plug the value of
36240 into the API explorer there you'll get this xml back ...
<rsp stat="ok"> <location name="Stoke on Trent" woeid="36240" place_id="gEXCB1iaB571gw" place_url="/United+Kingdom/England/Stoke+on+Trent"> <locality place_id="gEXCB1iaB571gw" woeid="36240">Stoke on Trent</locality> <county place_id="B_K1Z7iYA5qfCIiHaw" woeid="12602189">Staffordshire</county> <region place_id="pn4MsiGbBZlXeplyXg" woeid="24554868">England</region> <country place_id="DevLebebApj4RVbtaQ" woeid="23424975">United Kingdom</country> </location> </rsp>
Where you can see the same woeid, the URL to get to the Places page for Stoke on Trent, and the parent hierarchy flickr uses.
You can also plug the woeid into the flickr.photos.search to get photos back for just that area. A quick example of why that is useful is California, there's no way you'd want to find photos for California using the bounding box, as it covers a couple of other states ...
... but instead you can use the woeID for California (2347563) which deals with all the bends and kinks of CA. You can also throw that ID into the Places URL, like this ... http://www.flickr.com/places/2347563, although you'll probably want to pass that through flickr.places.resolvePlaceId first if you want a pretty URL.
Differences between Yahoo geo API stuff and Flickr
Over at Flickr, we only use specific 'levels' of geo information, such as city, region, state, country, while the APIs over at Yahoo will spit out far more levels in-between the ones Flickr uses, as well as deeper down to neighborhood levels, which Flickr doesn't do (yet).
Just because you get a WoeID back from Yahoo, doesn't mean we'll have photos for that specific area, we'll probably bounce you up to the next largest places we deal with. So our parent hierarchy will have less steps in it that the ones you get back from Yahoo's geo stuff. It also means our find by lat/long will only go down to town/city level and not precise neighborhood level.
We also don't do photos or Places pages for Landmark WoeIDs, taking their example of Sydney Opera House which gives you an ID of
28717584 and throwing that at Places will give you no photos (maybe one day), although you can bounce up to Sydney.
Anyway, it goes beyond photos at Flickr, it's just a really useful way that you, a developer can key off an ID for a place, that someone else, somewhere else can also key off.
If you use the ID
2347563 for California, and they use the ID
2347563 for California. And one, or both of you, publish your information with that ID, then you, they, or other people know that you're both talking about the same place and match that data up.
Which is nice.
[Update 2: For more official stuff about the Location Platform, you should probably see the Yahoo Local & Maps Blog post Abstracting Spatial Relationships with the Yahoo! Internet Location Platform where they use phrases such as "unambiguously", "permanent" and "language-neutral", and sum everything up far better than I]
[Update 3: and if you haven't yet checked it out, I still think its worth reading my blog post "Twitter API updates, FireEagle and new Flickr API fun" as an example of what to do with woe IDs]