Autosuggest not returning a bestView property


  • I have followed the example exactly located here:

    and the selectedSuggestion does not return a bestView property so I cannot zoom my map to a useful level.

    Thursday, April 13, 2017 11:59 AM


All replies

  • Can you provide the query you used?

    [Blog] [twitter] [LinkedIn]

    Thursday, April 13, 2017 3:32 PM
  • My code is below.  It's the selectedSuggestion object that is missing the besView property.

    function loadMap() {
        map = new Microsoft.Maps.Map(document.getElementById("mapHolder"), {
            credentials: "BING_MAPS_KEY",
            zoom: 10
        Microsoft.Maps.Events.addHandler(map, "viewchangestart", clearMap);
        Microsoft.Maps.Events.addHandler(map, "viewchangeend", loadPins);
        infoBox = new Microsoft.Maps.Infobox(null, {
            visible: false,
            maxWidth: 500,
            maxHeight: 500
        Microsoft.Maps.loadModule('Microsoft.Maps.AutoSuggest', function () {
            var options = {
                map: map,
                useMapView: false
            var manager = new Microsoft.Maps.AutosuggestManager(options);
            manager.attachAutosuggest('#searchBox', '#searchBoxContainer', selectedSuggestion);
        if ($("#hdnLat").length != 0) {
                center: new Microsoft.Maps.Location($("#hdnLat").val(), $("#hdnLng").val()),
                zoom: 15
        } else {
    function selectedSuggestion(result) {
        map.setView({ center: new Microsoft.Maps.Location(result.location.latitude, result.location.longitude) });
    Friday, April 21, 2017 10:10 AM
  • By query, I meant the text you typed into the autosuggest textbox. Have you tried the experimental branch to see if this issue occurs there?

    [Blog] [twitter] [LinkedIn]

    Friday, April 21, 2017 2:14 PM
  • Ah, sorry.  Now I understand.  I have tried many a query, for example London and then click on London, United Kingdom.

    I have also tried all three branches.

    Tuesday, April 25, 2017 4:07 PM
  • I'm not able to reproduce this and never have. London is one of my main test queries. I've just tested all three branches on all supported browsers and all of them worked as expected.

    [Blog] [twitter] [LinkedIn]

    Thursday, April 27, 2017 6:24 PM
  • Sorry it has taken me so long to respond.

    It's definitely not working.  Take a look on the Bing Maps Interactive SDK example page:

    no bestView property.

    This thread also reports the same issue.

    Thanks in advance

    Thursday, May 11, 2017 2:33 PM
  • That's working. I think the issue is that the best view may be larger than you are expecting. 

    [Blog] [twitter] [LinkedIn]

    Saturday, May 13, 2017 5:37 PM
  • No matter what I try, it doesn't work for me.  Just to be clear this is what I do:

    • visit:
    • Type any location E.G New York in the text box within the "Printout Window"
    • Click on a location from the list.
    • The pin moves to the new location
    • The map does not.

    I am in the UK so not sure if it's a regional issue.  I have tried on many PC's in the office and on a variety of browsers.  I have even inspected the response and there is not a bestView property.

    Really struggling on this and appreciate any help you can give.

    Monday, May 15, 2017 10:55 AM
  • I've managed to finally reproduce this. I will log this as a bug for the team to investigate.

    [Blog] [twitter] [LinkedIn]

    Monday, May 15, 2017 4:09 PM
  • Thanks Ricky. I thought I was losing my mind.

    Really appreciate your help.

    Monday, May 15, 2017 4:30 PM
  • I believe this should be fixed now. Can you test and verify. If it isn't working for you in the main release branch, try the experimental branch.

    [Blog] [twitter] [LinkedIn]

    Tuesday, June 27, 2017 1:05 AM