views:

2830

answers:

8

Hi out there,

i searched a while but found nothing, thats simular to my problem.

i'm trying to use the YAHOO Weather API, for example: http://weather.yahooapis.com/forecastrss?w=4097

i don't know the WOEID in my case, but i got latitude and longitude points.

so my question is: is there a way to get the WOEID of a place by using lat and long points?

A: 

Yahoo api uses weather.com actually, so go to weather.com and search for your local weather. I'm in Chicago so I entered 'Chicago, IL' and here's the link in my browser bar showing my weather:

http://www.weather.com/weather/today/Chicago+IL+USIL0225?lswe=chicago,%20il&from=searchbox_localwx

In the link is the woeid - which is USIL0225

You can get yours the same way.

But the question is not how to get the woeid by city and state. It is for latitude and longitude.
salt.racer
"USIL0225" is not a woeid. Woeids are numeric.
HD
+3  A: 

This is not using Yahoo's API but I found this blog post: http://geomojo.org/?p=38

Mentioning this service: http://www.geomojo.org/cgi-bin/reversegeocoder.cgi?long=-117.699444&lat=35.4775

Perhaps you can use that? It solved my problem, I hope it helps in solving yours.

salt.racer
thanks :) i think this is the best way i can do it.
choise
+3  A: 

Yahoo! does not directly offer such reverse geocoding via one of their geo APIs.

As salt.racer pointed out in his answer you could use geomojo's offering. Alternatively read that blog post and implement it yourself (create a short document with a suitable geo-microformat embedded and submit it to Yahoo!'s PlaceMaker service; if you put multiple such microformats into the document you could even reverse geocode multiple points with one API call for better performance).

Another solution is to use a Flickr API which happens to do this: http://www.flickr.com/services/api/flickr.places.findByLatLon.htm

HD
+1  A: 

Seems like you got it the wrong way around. This is the URL on weather.yahoo.com: weather.yahoo.com/united-states/illinois/chicago-2379574/ The last bit is the WOEID for Chicago, i.e. 2379574

WOEIDs are described in the GeoPlanet docs: http://developer.yahoo.com/geo/geoplanet/guide/concepts.html#woeids

Walter
A: 

There is a topic about this issue at the YDN forums http://developer.yahoo.net/forum/index.php?showtopic=69

Looks like it's buried in the to-do list, from 2008 "The ability to map a set of longitude and latitude coordinates to a WOEID, from which information such as ZIP and State may be derived, has already been identified as a valuable feature and it is on our enhancement request list."

Other quotes;

"Flickr has a method: flickr.places.findByLatLon which returns a WOEID, but they truncate coordinates to three decimal places."

In this topic a Yahoo dev also suggests using the advice at http://geomojo.org/?p=38 as an interim solution.

Chaoley
+1  A: 

It is somewhat ridiculous that Yahoo doesn't provide a lookup method for WOEIDs via lat/lon--it's been on their todo list since 2008--but that's the state of things.

I would caution you against using the suggested workaround implemented at Geomojo. If it works for your data, great, but the Yahoo service that Geomojo relies on is unpredictable. Geomojo uses Yahoo's PlaceMaker, which extracts location information from unstructured text to get a WOEID. It does this by creating a microformat containing your lat/lon pair and submitting it to PlaceMaker. However, since PlaceMaker returns WOEIDs for zip codes there's a loss of resolution and you will sometimes not be able to identify even the town for submitted coordinates. I have a number of example points on the east coast of the U.S. where the PlaceMaker WOEIDs do not correspond to the submitted lat/lon pairs.

Strangely, as HD writes, only Flickr's API provides a simple way to lookup a WOEID from lat/lon. Flickr's findByLatLon method has great resolution. It will usually return a neighborhood (one level below town) for a pair of coordinates.

Ryan
A: 

You can use Flickr's reverse geocoding API through YQL.

Here is a link to the YQL with an example query to find the WOEID for a given lat/lon: http://developer.yahoo.com/yql/console/#h=select%20place.woeid%20from%20flickr.places%20where%20lat%3D43%20and%20lon%3D-94

The above query can be called directly from your app with this URL (XML/JSON formats available): http://query.yahooapis.com/v1/public/yql?q=select%20place.woeid%20from%20flickr.places%20where%20lat%3D43%20and%20lon%3D-94&format=xml

ejunker
A: 

This is now available through the recently released PlaceFinder API. Kudos to Yahoo! for providing yet another important piece of the Geo puzzle.

fiskfisk