none
SearchManager: geocodeRequestOptions.bounds doesn't appear to work

    Question

  • I'm performing a geocode operation via the SearchManager in the V7 AJAX control.

    Here's a small reproduction of my approach:

    jsFiddle

    I'm supply a bounding box that contains the UK mainland to limit the search area as described on: 

    MSDN - GeocodeRequestOptions Object

    "A location rectangle that defines the boundaries of the area in which to search for location results. The default is the bounds of the map view associated with this instance of the SearchManager, which is usually the current map view."

    The bounding box is visualised on the map as two pushpins showing the corners and a rectangular bounding box showing the area they describe.

    If you search for "london" by typing it in to the text box and then hitting "Search" you'll see that results from well outside the bounds show up.

    Am I doing something wrong?


    • Edited by Andy Jump Wednesday, October 30, 2013 12:50 PM
    Wednesday, October 30, 2013 12:49 PM

Answers

  • The bounds is not meant to limit the results to a specific area. It is meant to give the geocoder some context on where you are looking so that it can try and prioritize the most likely results. If it did filter the results to the current view the SearchManager would pretty useless as you would already have to have the location you are looking for in view.

    In the past more weight was given to the bounds and the user IP address when doing searches. This resulting a lot less addresses being found and made it seem like the service was broken. If you want to only see results that are within a specific area then filter the results when they return. An easy way to do this is to create a LocationRect of your bounding box and then use the contains function to check if the location is within the bounding box: http://msdn.microsoft.com/en-us/library/gg427621.aspx


    http://rbrundritt.wordpress.com

    Thursday, October 31, 2013 9:24 AM
    Owner
  • I've also passed this information on to the person who manages the documentation.

    http://rbrundritt.wordpress.com

    Thursday, October 31, 2013 1:10 PM
    Owner

All replies

  • The bounds is not meant to limit the results to a specific area. It is meant to give the geocoder some context on where you are looking so that it can try and prioritize the most likely results. If it did filter the results to the current view the SearchManager would pretty useless as you would already have to have the location you are looking for in view.

    In the past more weight was given to the bounds and the user IP address when doing searches. This resulting a lot less addresses being found and made it seem like the service was broken. If you want to only see results that are within a specific area then filter the results when they return. An easy way to do this is to create a LocationRect of your bounding box and then use the contains function to check if the location is within the bounding box: http://msdn.microsoft.com/en-us/library/gg427621.aspx


    http://rbrundritt.wordpress.com

    Thursday, October 31, 2013 9:24 AM
    Owner
  • Thanks for the information, what you say makes a lot of sense.

    I've marked that MSDN page as "Not Useful" and "<label for="checkboxNo201">Not accurate</label> " with a comment of:

    "The 'bounds' property does not define the boundary of the search as the documentation describes. It rather defines the boundary of the area which you are most interested in to help provide context for prioritisation of results. See here for more information: http://social.msdn.microsoft.com/Forums/en-US/03056d1f-3633-40aa-9e01-ded456a77938/searchmanager-geocoderequestoptionsbounds-doesnt-appear-to-work"

    Thanks once again for the swift reply, hopefully the documentation will be corrected.

    Thursday, October 31, 2013 11:16 AM
  • I've also passed this information on to the person who manages the documentation.

    http://rbrundritt.wordpress.com

    Thursday, October 31, 2013 1:10 PM
    Owner