0

q filter country code

The geo docs say "The .q filter supports an optional country code, which is used to adjust the order of the results." But I've found no information about how to specify the optional country code. In a few tests just adding a US to the end of the query string doesn't work. Also should we assume this is an ISO country code?

by
3 Replies
  • The optional country code follows the ISO 3166-1 Alpha-2 specification for country codes. Note that using a country focus may not significantly alter the order of highly probable results. Queries for London, Paris, Rome will always return "London, GB", "Paris, FR", "Rome, IT" over similarly named places in other countries.

    If you want to limit results to a specific country, you will need to filter the results yourself. We are considering an enhancement to the .q filter that would provide this capability.

    Eddie Babcock
    Yahoo! Geo Technologies

    QUOTE (Brad Schick @ Feb 16 2009, 01:21 PM) <{POST_SNAPBACK}>
    The geo docs say "The .q filter supports an optional country code, which is used to adjust the order of the results." But I've found no information about how to specify the optional country code. In a few tests just adding a US to the end of the query string doesn't work. Also should we assume this is an ISO country code?
    0
  • Could you post an example of how to use the "filter by country" example?

    If i try http://where.yahooapis.com/v1/places$and(....n&appid=XXX

    I get México as a country, not Córdoba city in México.

    Thanks!!

    QUOTE (Eddie B @ Feb 20 2009, 10:23 AM) <{POST_SNAPBACK}>
    The optional country code follows the ISO 3166-1 Alpha-2 specification for country codes. Note that using a country focus may not significantly alter the order of highly probable results. Queries for London, Paris, Rome will always return "London, GB", "Paris, FR", "Rome, IT" over similarly named places in other countries.

    If you want to limit results to a specific country, you will need to filter the results yourself. We are considering an enhancement to the .q filter that would provide this capability.

    Eddie Babcock
    Yahoo! Geo Technologies
    0
  • The .q filter accepts a second parameter containing an ISO country code. Results matching the first parameter that are in that country will have their probabilities adjusted upward, making them more likely to be returned at or near the top of the the results list. Here is how you use the focus parameter:

    CODE
    http://where.yahooapis.com/v1/places.q(Cordoba,MX);count=0?format=json&appid=XXX
    This returns 16 results, with the ones in Mexico at the top.

    Note that this is different than including the country code in the first parameter, which will not return places in other countries if any places are found in the country:

    CODE
    http://where.yahooapis.com/v1/places.q('Cordoba,MX');count=0?format=json&appid=XXX
    This returns 2 results. Note the quotes around the query string.

    CODE
    http://where.yahooapis.com/v1/places.q('Cordoba,JP');count=0?format=json&appid=XXX
    This returns 16 results because there is no place named Cordoba in Japan.

    In order to distinguish between places having the same name, you may need to provide additional information in the query string. For example, if you want the Cordoba in Durango State, Mexico, you would need to include the state name the query string:

    CODE
    http://where.yahooapis.com/v1/places.q('Cordoba,Durango,MX');count=0?format=json&appid=XXX
    This returns 1 result.

    Eddie Babcock
    Yahoo! Geo Technologies

    QUOTE (gaizkav @ Mar 9 2009, 02:48 AM) <{POST_SNAPBACK}>
    Could you post an example of how to use the "filter by country" example?

    If i try http://where.yahooapis.com/v1/places$and(....n&appid=XXX

    I get México as a country, not Córdoba city in México.

    Thanks!!
    0
This forum is locked.

Recent Posts

in GeoPlanet General Discussion