Leaflet.Polyline.SnakeAnim icon indicating copy to clipboard operation
Leaflet.Polyline.SnakeAnim copied to clipboard

Large route Uncaught RangeError: Maximum call stack size exceeded

Open HeikkiVesanto opened this issue 10 years ago • 1 comments

Hi,

Excellent plugin. Really nice visuals.

For quite large routes I do sometimes run into an error: Uncaught RangeError: Maximum call stack size exceeded

Uncaught RangeError: Maximum call stack size exceeded L.Projection.SphericalMercator.project @ leaflet-src.js:1465 L.CRS.latLngToPoint @ leaflet-src.js:1499 L.Map.L.Evented.extend.project @ leaflet-src.js:2060 L.Map.L.Evented.extend.latLngToLayerPoint @ leaflet-src.js:2074 L.Map.L.Evented.extend.latLngToContainerPoint @ leaflet-src.js:2100 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:81 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106 L.Polyline.include._snakeForward @ L.Polyline.SnakeAnim.js:106

Example can be found at: http://maps.gisforthought.com/leaflet_snake_demo/demo.html

With the route file: http://maps.gisforthought.com/leaflet_snake_demo/route.js

But works on a simplified version of the same route.

HeikkiVesanto avatar Oct 30 '15 19:10 HeikkiVesanto

I know, there is a problem with the recursive tail calls. It's not about now large the route is, but rather about how many vertices have to be skipped in a frame.

The solution is to replace the recursive calls to _snakeForward with a loop. Right now I'm not focusing on this plugin, so feel free to work on a solution.

IvanSanchez avatar Oct 30 '15 19:10 IvanSanchez