|
26 | 26 | //Create an array of point features with timestamp information to define a route to animate along. |
27 | 27 | //To animate a route, there must be a _timestamp property that has a value from Date.getTime(). |
28 | 28 | var routePoints = [ |
29 | | - new atlas.data.Feature(new atlas.data.Point([-122.34758, 47.62155]), { _timestamp: new Date('Tue, 18 Aug 2020 00:53:53 GMT').getTime() }), |
30 | | - new atlas.data.Feature(new atlas.data.Point([-122.34764, 47.61859]), { _timestamp: new Date('Tue, 18 Aug 2020 00:54:53 GMT').getTime() }), |
31 | | - new atlas.data.Feature(new atlas.data.Point([-122.33787, 47.61295]), { _timestamp: new Date('Tue, 18 Aug 2020 00:56:53 GMT').getTime() }), |
32 | | - new atlas.data.Feature(new atlas.data.Point([-122.34217, 47.60964]), { _timestamp: new Date('Tue, 18 Aug 2020 00:59:53 GMT').getTime() }) |
| 29 | + new atlas.data.Feature(new atlas.data.Point([-122.34758, 47.62155]), { timestamp: new Date('Tue, 18 Aug 2020 00:53:53 GMT').getTime() }), |
| 30 | + new atlas.data.Feature(new atlas.data.Point([-122.34764, 47.61859]), { timestamp: new Date('Tue, 18 Aug 2020 00:54:53 GMT').getTime() }), |
| 31 | + new atlas.data.Feature(new atlas.data.Point([-122.33787, 47.61295]), { timestamp: new Date('Tue, 18 Aug 2020 00:56:53 GMT').getTime() }), |
| 32 | + new atlas.data.Feature(new atlas.data.Point([-122.34217, 47.60964]), { timestamp: new Date('Tue, 18 Aug 2020 00:59:53 GMT').getTime() }) |
33 | 33 | ]; |
34 | 34 |
|
35 | 35 | function GetMap() { |
|
119 | 119 | pin = new atlas.Shape(routePoints[0]); |
120 | 120 | pinSource.add(pin); |
121 | 121 |
|
| 122 | + //Extract timestamp information from a custom property of the point features. |
| 123 | + //By default the `moveAlongRoute` function looks for a `_timestamp` property on the point features that is a Date.getTime() value. |
| 124 | + //If your points already have a `_timestamp` property with the correct value type, you can skip this extraction step. |
| 125 | + routePoints = atlas.animations.extractRoutePoints(route, 'timestamp'); |
| 126 | + |
122 | 127 | //Create the animation. |
123 | 128 | animation = atlas.animations.moveAlongRoute(routePoints, pin, { |
124 | | - //Specify the property that contains the timestamp. |
125 | | - timestampProperty: 'timestamp', |
126 | 129 |
|
127 | 130 | //Capture metadata so that data driven styling can be done. |
128 | 131 | captureMetadata: true, |
|
0 commit comments