locked
Possible bug with Find Location by Query using UserRegion RRS feed

  • Question

  • Hi!

    I have a strange issue where a Find Location by Query fails to return any results when I include UserRegion.  When I exclude UserRegion, I get results.  I have been running this code _with_ UserRegion in production for over a year.  I don't know exactly when it started to fail, but I think it was either late November, 2017 or early December.

    Here is an example that works.  (I have removed by API Key)

    Locations?query=115%20States%20ST%20%2C%20Montpelier%2C%20VT%2097005&includeNeighborhood=0&maxResults=5&userRegion=&userLocation=&userMapView=&userIp=127.0.0.1&key=removed

    Here is an example that does not work.  The only difference is that UserRegion is set to US-VT.

    Locations?query=115%20States%20ST%20%2C%20Montpelier%2C%20VT%2097005&includeNeighborhood=0&maxResults=6&userRegion=US-VT&userIp=127.0.0.1&key=removed

    The base URL I am using is this: http://dev.virtualearth.net/REST/v1/

    I just tried both of these again right in my browser.  One gives results.  The other does not.

    I have many other examples like this.

    I had mistakenly implemented UserRegion thinking it would improve my results, but I do not think that is the purpose.  Instead I am going to use UserLocation and UserMapView as per this doc:  https://msdn.microsoft.com/en-us/library/ff701704.aspx 

    Friday, December 29, 2017 6:43 PM

Answers

  • User regions should only be ISO2 country code values such as "US". US-VT is invalid (looks like country-state code) and likely causing an error somewhere in the system, thus why no results being returned. The purpose of user region is help the geocoder ensure that it returns results that are inline with the views of the region in which the user is in. Particularly for geopolitical issues such as disputed place names and country border. For example, take the Persian Gulf, this name for that body of water is recognized by most countries in the united nations but there are many countries in the middle east and northern Africa which recognize this as the Arabian Gulf. As such, if you have a user region setting of US and search for "Persian Gulf" or "Arabian Gulf" a result for "Persian Gulf" will be returned. However, if a user region of SA (Saudi Arabia) is specified, "Arabian Gulf" will be returned for both queries.

    The user map view is used to help weigh the relevance of the results that are returned. If the user searches for "London", normally "London, UK" is the top result, but if the map view is a bounding box over Ohio, "London, Ohio" will likely be higher ranked in the results, although in this case I think London, UK is still more commonly the expected result for users in Ohio since London, Ohio has a fairly small population.


    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Saturday, December 30, 2017 12:56 AM
    • Marked as answer by Jess Lilly Tuesday, January 2, 2018 3:50 PM
    Saturday, December 30, 2017 12:56 AM

All replies

  • User regions should only be ISO2 country code values such as "US". US-VT is invalid (looks like country-state code) and likely causing an error somewhere in the system, thus why no results being returned. The purpose of user region is help the geocoder ensure that it returns results that are inline with the views of the region in which the user is in. Particularly for geopolitical issues such as disputed place names and country border. For example, take the Persian Gulf, this name for that body of water is recognized by most countries in the united nations but there are many countries in the middle east and northern Africa which recognize this as the Arabian Gulf. As such, if you have a user region setting of US and search for "Persian Gulf" or "Arabian Gulf" a result for "Persian Gulf" will be returned. However, if a user region of SA (Saudi Arabia) is specified, "Arabian Gulf" will be returned for both queries.

    The user map view is used to help weigh the relevance of the results that are returned. If the user searches for "London", normally "London, UK" is the top result, but if the map view is a bounding box over Ohio, "London, Ohio" will likely be higher ranked in the results, although in this case I think London, UK is still more commonly the expected result for users in Ohio since London, Ohio has a fairly small population.


    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Saturday, December 30, 2017 12:56 AM
    • Marked as answer by Jess Lilly Tuesday, January 2, 2018 3:50 PM
    Saturday, December 30, 2017 12:56 AM
  • Thank you very much for the response!  US-VT was working fine for quite some time.

    O - M - G.  I just discovered the issue.  The documentation is pointing to the wrong wikipedia article.

    On the User Context Parameters page, it correctly says ISO 3166-1 Alpha-2 region/country code.  But the hyperlink points to ISO 3166-2.  It should instead point to this wikipedia page: ISO 3166-1 Alpha 2.

    Wow, this does help explain my previous confusion that UserRegion would help prioritize results to specific US states.

    Ricky, it was a pleasure working with you and thank you so much for the help.  I will update my code and please help get that hyperlink fixed.  Happy 2018!

    Monday, January 1, 2018 2:52 PM
  • Thanks for reporting. I've updated the documentation link.

    [Blog] [twitter] [LinkedIn]

    Monday, January 1, 2018 5:04 PM