function loadMapScenario() { var map = new Microsoft.Maps.Map(document.getElementById('myMap'), { credentials: '...', disableStreetside: true, mapTypeId: Microsoft.Maps.MapTypeId.road, enableSearchLogo: false, showMapTypeSelector: false, showScalebar: false }); Microsoft.Maps.Events.addHandler(map, 'click', function (e) { if (e.targetType == 'map') { var point = new Microsoft.Maps.Point(e.getX(), e.getY()); var loc = e.target.tryPixelToLocation(point); var location = new Microsoft.Maps.Location(loc.latitude, loc.longitude); Microsoft.Maps.loadModule('Microsoft.Maps.Search', function () { var searchManager = new Microsoft.Maps.Search.SearchManager(map); var reverseGeocodeRequestOptions = { location, callback: function (answer, userData) { var zipcode = answer.address.postalCode; } } searchManager.reverseGeocode(reverseGeocodeRequestOptions); var infobox = new Microsoft.Maps.Infobox(location, { title: 'Map Center',description: '' + zipcode}); infobox.setMap(map); }); } }); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)