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