Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receive a WOEID by Lat, Long with Yahoos API

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?

like image 312
choise Avatar asked Jan 19 '10 12:01

choise


2 Answers

Yahoo! PlaceFinder API allows you to find a corresponding WOEID for a latitude/longitude pair. Consider this example web service method call:

http://where.yahooapis.com/geocode?location=37.42,-122.12&flags=J&gflags=R&appid=zHgnBS4m

You can play with request parameters according to your needs, see Yahoo! PlaceFinder API documentation for more. And you should replace appid with your Yahoo! appid, you can create one here.

This request returns a response like that, which includes a lot of useful data along with the WOEID:

{
    "ResultSet": {
        "version": "1.0",
        "Error": 0,
        "ErrorMessage": "No error",
        "Locale": "us_US",
        "Quality": 99,
        "Found": 1,
        "Results": [
            {
                "quality": 99,
                "latitude": "37.420000",
                "longitude": "-122.120000",
                "offsetlat": "37.420000",
                "offsetlon": "-122.120000",
                "radius": 500,
                "name": "37.42,-122.12",
                "line1": "3589 Bryant St",
                "line2": "Palo Alto, CA  94306-4207",
                "line3": "",
                "line4": "United States",
                "house": "3589",
                "street": "Bryant St",
                "xstreet": "",
                "unittype": "",
                "unit": "",
                "postal": "94306-4207",
                "neighborhood": "",
                "city": "Palo Alto",
                "county": "Santa Clara County",
                "state": "California",
                "country": "United States",
                "countrycode": "US",
                "statecode": "CA",
                "countycode": "",
                "hash": "",
                "woeid": 12797284,
                "woetype": 11,
                "uzip": "94306"
            }
        ]
    }
}
like image 37
Ahmet Ardal Avatar answered Sep 29 '22 17:09

Ahmet Ardal


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

like image 132
MatsLindh Avatar answered Sep 29 '22 18:09

MatsLindh