0

Retrieving cities for a state

Is there an appropriate call to pull cities (type 7) from the REST API?

I've tried two ways, but both are currently failing:

http://where.yahooapis.com/v1/place/234759...egree(2)?appid=
- gives 404

http://where.yahooapis.com/v1/place/234759....type(7)?appid=
- works occasionally

by
4 Replies
  • Looks like the descendants query is the best shot. I'm getting about 80-90% success with it. Bigger states (more towns) are the ones having trouble.


    QUOTE (Ryan W @ Jul 7 2010, 02:21 PM) <{POST_SNAPBACK}>
    Is there an appropriate call to pull cities (type 7) from the REST API?

    I've tried two ways, but both are currently failing:

    http://where.yahooapis.com/v1/place/234759...egree(2)?appid=
    - gives 404

    http://where.yahooapis.com/v1/place/234759....type(7)?appid=
    - works occasionally
    0
  • QUOTE (Ryan W @ Jul 7 2010, 08:13 PM) <{POST_SNAPBACK}>
    Looks like the descendants query is the best shot. I'm getting about 80-90% success with it. Bigger states (more towns) are the ones having trouble.


    Trying to retrieve lists of places using children.degree() or descendants can be a hit-or-miss affair. Oregon has over 2,500 towns. GeoPlanet Web Service is not designed to return long lists (>2000 results), so it's best to keep such requests focused to limit the number of results returned. One way to limit results is to use a .type filter to restrict the results to a single placetype. Another way to limit results is to use places with small areas (such as counties). You can make multiple requests to GeoPlanet and combine the results.

    If you are trying to populate a database with information about a particular placetype, it might be better to download GeoPlanet Data (see http://developer.yahoo.com/geo/geoplanet/data/ ) and extract information from the supplied TSV files. Note that GeoPlanet Data does not contain any geometry (centroid or bounding box) for places.

    Eddie Babcock
    Yahoo! Geo Technologies
    0
  • Thanks Eddie, makes sense now. I was looking for the centroid and bounding box, so that led me to choose the API over the data files. I've explored doing the /children query at the county level too and will probably fall back to that now when the state query fails.


    QUOTE (Eddie B @ Jul 8 2010, 09:29 AM) <{POST_SNAPBACK}>
    Trying to retrieve lists of places using children.degree() or descendants can be a hit-or-miss affair. Oregon has over 2,500 towns. GeoPlanet Web Service is not designed to return long lists (>2000 results), so it's best to keep such requests focused to limit the number of results returned. One way to limit results is to use a .type filter to restrict the results to a single placetype. Another way to limit results is to use places with small areas (such as counties). You can make multiple requests to GeoPlanet and combine the results.

    If you are trying to populate a database with information about a particular placetype, it might be better to download GeoPlanet Data (see http://developer.yahoo.com/geo/geoplanet/data/ ) and extract information from the supplied TSV files. Note that GeoPlanet Data does not contain any geometry (centroid or bounding box) for places.

    Eddie Babcock
    Yahoo! Geo Technologies
    0
  • Hi guys... anybody knows how I can get a near places from other place and with certain distance... for example...
    washintong dc... how to get all near places from washintong dc in 200 miles
    thanks
    0
This forum is locked.

Recent Posts

in GeoPlanet General Discussion