Mapbox track playback

    Track playback is a common feature in webgis, is a being loved by customers GIS animation.

    Animation is a short stop to redraw achieve the effect of constant motion. In this paper, the track is played back calculate in advance the desired point, and then play it back.

    The overall idea is not complicated, there are a total of one thousand set insertion points, each point calculated step interval, we need the insertion point to each segment is greater than the step size as long as the like, a step size less than or equal segments the access to its tail node.
Only two points of the line segment densification is very simple to determine the length of the line divided by the multiple of the step, performed by multiple cycles, each calculated using turf.along to the point of insertion, when the segment does not divide the step size, necessary to insert the last point in the line segment densification. (The small arrow is densified FIG point)


    Renderings below, the online address: https://github.com/tpolong/route
Renderings
PS: write a small example stepped in turf.js two pit or a little worse, do not say I buy a lottery ticket the

ps2: You can use turf.linechunk turf.lineSliceAlong or densified, of course, this function is still turf.linechunk pit, caution

Guess you like

Origin www.cnblogs.com/polong/p/10993459.html