0

Countries and Cities from arbitrary WOEID

In my data I have a whole lot of locations with associated WOEID's, courtesy of Placemaker.
The locations referred to can be any placetype. I need to identify the containing Country and City (and perhaps Continent, while we're at it) for each of them.

The Placemaker data gives the woeId of the place itself, as well as woeId's for its administrative and geographic scope. So, I know it should be possible to ascend the ancestors (or parents?) of the woeid and eventually come to a city, country and continent. (In some cases there might not be a city, but generally I expect locations are in countries and on continents.)

So, how should I get the data? Is there a API call that can give me the woeId/name of the City/State/Continent?

Or, would I have to import the GeoPlanet data and do it myself -- and if so, any tips?

In reverse, is it possible to use a Country woeId to get all woeId's within that country?

Thanks,
Liam

by
1 Reply
  • QUOTE (LiamK @ Nov 24 2010, 05:29 PM) <{POST_SNAPBACK}>
    In my data I have a whole lot of locations with associated WOEID's, courtesy of Placemaker.
    The locations referred to can be any placetype. I need to identify the containing Country and City (and perhaps Continent, while we're at it) for each of them.

    The Placemaker data gives the woeId of the place itself, as well as woeId's for its administrative and geographic scope. So, I know it should be possible to ascend the ancestors (or parents?) of the woeid and eventually come to a city, country and continent. (In some cases there might not be a city, but generally I expect locations are in countries and on continents.)

    So, how should I get the data? Is there a API call that can give me the woeId/name of the City/State/Continent?

    Or, would I have to import the GeoPlanet data and do it myself -- and if so, any tips?

    In reverse, is it possible to use a Country woeId to get all woeId's within that country?

    Thanks,
    Liam


    GeoPlanet can return to you the names and WOEIDs of the administrative areas and belongtos associated with a place using the belongtos collection:

    CODE
    http://where.yahooapis.com/v1/place/2388327/belongtos;count=0?appid=[myappid]


    If are interested in specific placetypes, you can include a filter:

    CODE
    http://where.yahooapis.com/v1/place/2388327/belongtos.type(town,country,continent)?appid=[myappid]

    This requests returns only Town (city), Country, and Continent places; in this example, no Town place is returned

    Eddie Babcock
    Yahoo! Geo Technologies
    0
This forum is locked.

Recent Posts

in GeoPlanet General Discussion