Microsoft.Maps.SpatialMath.Geometry.bounds() returns incorrect LocationRect RRS feed

  • Question

  • It appears to ignore certain locations. Here's a simple visual example:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        credentials: 'Your Bing Maps Key'
    Microsoft.Maps.loadModule('Microsoft.Maps.SpatialMath', function () {
    	var locations = [
    		new Microsoft.Maps.Location(37.330, -122.029),
    		new Microsoft.Maps.Location(28.823, -81.710),
    		new Microsoft.Maps.Location(31.222, 121.354)
    	for(var i = 0; i < locations.length; i++) {
    		map.entities.push(new Microsoft.Maps.Pushpin(locations[i], null));
    	var bounds = Microsoft.Maps.SpatialMath.Geometry.bounds(locations);
    	map.setView({bounds: bounds});
        // Convert the map bounds LocationRect to Polygon 
        var polygon = Microsoft.Maps.SpatialMath.locationRectToPolygon(bounds);

    Tuesday, November 8, 2016 3:31 AM


  • The bounds function is working correctly, the issue is that the Bing Maps V8 control doesn't currently support data that crosses the international date line. This is known as a world wrap issue and is common in a lot of mapping APIs. The team plans to correct this in the future but it is a fairly large amount of work, and there are a number of higher priority tasks the team are working on at the moment.

    [Blog] [twitter] [LinkedIn]

    Wednesday, November 30, 2016 5:00 PM