none
REST service returns different results when using different key

    Question

  • The results returned by the REST location service seem to differ depending on which key I use. When I use the 'Bing Maps V7 Interactive SDK' and search for ‘Amsterdam’ it returns Amsterdam in The Netherlands as the first result, which is exactly what I want. When I extract the REST call and perform it manually it still gives the same result.

    However, as soon as I use my own key in the same call, ‘Amsterdam, NY’ in the US becomes the first result. This is bad since in our application the results can be worldwide, but Amsterdam in the Netherlands makes a lot more sense than a much smaller and lesser known Amsterdam in the US.

    The call I do is:

    http://dev.virtualearth.net/REST/v1/Locations/amsterdam?output=json&jsonp=SearchServiceCallback&key=[Dev Key / Interactive SDK key]

    Why do the different keys give different results? Is there anything special about the key used by the interactive SDK? Are there any settings related to my own key I could change to get the same result as I get with the SDK key? Am I overlooking something else?

    Monday, October 28, 2013 12:08 PM

Answers

  • I'm not able to reproduce the differences, but do see a US city as the first result being returned using a basic search. This is actually to be expected as the default culture is "en-US". When the culture is en-US, US based locations get a bit more priority, Amsterdam in the Netherlands actually shows up as the second result. Changing the culture to a European language such as en-GB results in the Netherlands result being first. The REST services use a lot of different things to help prioritize and narrow down searches. When using the map control the bounding box of the map view is actually also used to help with the search. Things like your IP address can also have an effect. I wrote a blog post a while back on tips and tricks on the REST services that addresses this.

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx

    Also, if you just want to do geocoding inside of the map control, use the Search module instead of the REST services and save yourself some time.


    http://rbrundritt.wordpress.com

    Monday, October 28, 2013 4:21 PM
  • Both of those are returning Amsterdam, NY for me which is to be expected as there is no culture code or country specified in your search so it's defaulting to the US. If you don't want to specify a country then specify a culture code. If you are using the Bing Maps v7 or Windows 8 controls, consider using the search manager instead of the REST services. The search manager will also use the map view to help prioritize locations accordingly. The REST services only need to be used if geocoding with the Bing Maps WPF or Silverlight, or geocoding from a backend service.

    Thursday, October 31, 2013 9:48 AM

All replies

  • I'm not able to reproduce the differences, but do see a US city as the first result being returned using a basic search. This is actually to be expected as the default culture is "en-US". When the culture is en-US, US based locations get a bit more priority, Amsterdam in the Netherlands actually shows up as the second result. Changing the culture to a European language such as en-GB results in the Netherlands result being first. The REST services use a lot of different things to help prioritize and narrow down searches. When using the map control the bounding box of the map view is actually also used to help with the search. Things like your IP address can also have an effect. I wrote a blog post a while back on tips and tricks on the REST services that addresses this.

    http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx

    Also, if you just want to do geocoding inside of the map control, use the Search module instead of the REST services and save yourself some time.


    http://rbrundritt.wordpress.com

    Monday, October 28, 2013 4:21 PM
  • Find here an example to reproduce.

    The key from the Bing Maps V7 Interactive SDK returns Amsterdam, Netherlands as first result:
    /REST/v1/Locations/amsterdam?output=json&jsonp=SearchServiceCallback&key=AoKtwiuktsMlCWVPP2fRk4WtUfWvyUko5aK_4hsUmfIwyASECV5oRScVFemuLcj0&maxResults=1

    The trail key (which I just created) returns Amsterdam, NY as first result:
    /REST/v1/Locations/amsterdam?output=json&jsonp=SearchServiceCallback&key=Agw6rlNaCfk6_kehuzeNqE3HGgLDeTgcs99SaDaheM69nF9Uw2EfAJIdDco4VOVF&maxResults=1

    ---------------

    For our application the place where people are at the moment is not predicative for the address that they enter. Is there a way to tell Bing Maps to be less US centric (without specifying a specific other region since we don't want to replace it by another focus)?

    Amsterdam, The Netherlands is a national capital with ca. 50 times the population of Amsterdam, NY. It works by the way for other capitals such as London, Paris, and Moscow. Bing doesn't return the smaller US city but the right non-US city for those.
    Thursday, October 31, 2013 8:34 AM
  • Both of those are returning Amsterdam, NY for me which is to be expected as there is no culture code or country specified in your search so it's defaulting to the US. If you don't want to specify a country then specify a culture code. If you are using the Bing Maps v7 or Windows 8 controls, consider using the search manager instead of the REST services. The search manager will also use the map view to help prioritize locations accordingly. The REST services only need to be used if geocoding with the Bing Maps WPF or Silverlight, or geocoding from a backend service.

    Thursday, October 31, 2013 9:48 AM
  • Thanks for the feedback, Ricky. Which culture code would we have to set for international (e.g. no specific country/continent preference)?

    We use the REST service indeed for geo coding in a backend service.
    Tuesday, November 05, 2013 8:36 PM