0

Focus param for places web service

I'm sure this was working a minute ago...

CODE
GET /v1/places.q(southampton,GB);count=10;start=0?appid=XXX


is now returning all places matching southampton, from the whole world, rather than just those in GB, which is what I want, and what I think was happening until recently.

... or have I done something wrong?

by
2 Replies
  • QUOTE (neil.crookes @ Apr 12 2010, 02:54 AM) <{POST_SNAPBACK}>
    I'm sure this was working a minute ago...

    CODE
    GET /v1/places.q(southampton,GB);count=10;start=0?appid=XXX


    is now returning all places matching southampton, from the whole world, rather than just those in GB, which is what I want, and what I think was happening until recently.

    ... or have I done something wrong?


    The focus parameter of the .q filter adjusts the order that matching places are returned. Places in the specified country (or any woeid) will be given higher probability than other places. This "boost in ranking" may not be enough to always return a place in the specified country as the first result. If you only want to work with places in a specific country, it would be better to include the country code or name in the place parameter of the .q filter (for example, .q('southhampton,gb')). The single quotes are necessary to prevent GeoPlanet from treating the comma as a separator between the place and focus parameters. You could also filter the results to restrict places to a specific country or region.

    Eddie Babcock
    Yahoo! Geo Technologies
    0
  • QUOTE (Eddie B @ Apr 12 2010, 10:46 AM) <{POST_SNAPBACK}>
    it would be better to include the country code or name in the place parameter of the .q filter (for example, .q('southhampton,gb')).


    Trouble is though, if someone searches for an non existent place, e.g. .q('afkafjhaf,gb'), then the service appears to look for the next place, i.e. the one after the comma, which is 'gb' and I get a result for gb, rather than no results.

    I guess I'll just have to check for this in my application though.

    BTW, there isn't much info on focus in the online documentation, and I mistakenly interpreted 'focus' to mean restrict results to those in this country. The documentation could do with clarifying it's true meaning.

    It would be cool to accept an 'under' or 'parent' parameter that accepts a WOEID to restrict results to those under it.
    0
This forum is locked.

Recent Posts

in GeoPlanet General Discussion