1
Vote

AnimationModule path issue on Bing Maps v8

description

I'm having problems with the AnimationModule on Bing Maps v8. If a path crossed the international date line (when the longitude goes from -180 to 180), the path jumps horizontally all the way across the map (to get to the other side of the date line) and continues on it's arc. Below is the animation code used after initializing the map as the variable map. Attatched are screenshots of what it looks like.
Microsoft.Maps.registerModule('AnimationModule', '/assets/AnimationModule.js');
Microsoft.Maps.loadModule('AnimationModule');
const path = [
    new Microsoft.Maps.Location(42.8, 12.49),   //Italy
    new Microsoft.Maps.Location(51.5, 0),       //London
    new Microsoft.Maps.Location(40.8, -73.8),   //New York
    new Microsoft.Maps.Location(47.6, -122.3),  //Seattle
    new Microsoft.Maps.Location(35.4, 139.4)    //Tokyo
];
let line;
const isGeodesic = true;

let currentAnimation = new Bing.Maps.Animations.PathAnimation(path, function (coord, idx, frameIdx) {
    if (frameIdx == 1) {
        //Create the line the line after the first frame so that we have two points to work with.
        line = new Microsoft.Maps.Polyline([path[0], coord]);
        map.entities.push(line);
    }
    else if (frameIdx > 1) {
        let points = line.getLocations();
        points.push(coord);
        line.setLocations(points);
    }
}, isGeodesic, 40000);

currentAnimation.play();

file attachments

comments

bman4789 wrote Nov 25, 2016 at 7:57 PM

Here is a second screenshot, but more zoomed in.