Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leaflet polyline SmoothFactor range

According to LeafLet documentation PolyLine has a "smoothFactor" parameter : http://leafletjs.com/reference.html#polyline which allows polyline simplification to improve performance. Does anyone know what is the range (e.g. min and max values) and if you noticed a performance improvement using it? I tried different values like 0.1, 1, 5, 10, 100, and did not notice a change in zoom/panning performance at all.

like image 933
eagle2 Avatar asked Jul 23 '14 19:07

eagle2


2 Answers

Here is a demo: "example of leaflets built-in Simplification - Polyline_smoothFactor"

like image 75
nauti Avatar answered Oct 13 '22 09:10

nauti


The default value is 1. Larger numbers will improve performance and smooth polygon shapes. In my experience I ran about 10,000 shapes using smoothFactor=3. The performance improvement was barely noticeable (1/4 of a second faster loading time) but the shapes (polygons) were way too simplistic, turning almost every shape into triangles and squares.

like image 3
elmaroto10 Avatar answered Oct 13 '22 09:10

elmaroto10