none
How to set zoom level with search RRS feed

  • Question

  • I'm trying to set my zoom level with a geosearch, but no matter where I put it, I can't get it to zoom.

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), { credentials: 'Your Bing Maps Key'});
    Microsoft.Maps.loadModule('Microsoft.Maps.Search', function () {
    var searchManager = new Microsoft.Maps.Search.SearchManager(map);
    var requestOptions = {
    bounds: map.getBounds(),
    where: '46.109920,-64.754440',
    callback: function (answer, userData) {
    map.setView({

    bounds: answer.results[0].bestView,
    zoom:18
    });
    var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), { text: 'A', title: 'Title', subTitle: 'Subtitle' });
    map.entities.push(pushpin);
    }
    };
    searchManager.geocode(requestOptions);

    });

    Friday, November 18, 2016 2:45 PM

Answers