for the usage of multipolylines with leaflet, i have to instantiate the polyline like this...
var polyline = L.polyline([[], []], {color: generateRandomColor()}).addTo(map);
How do i instantiate the polyline with a dynamic quantity of rings(empty arrays)?
How can i do that? Thanks!
You can create a function which loops X times and adds empty arrays:
function createRings(rings){
var latlngs = [];
for(var i = 0; i < rings || 0; i++){
latlngs.push([]);
}
return latlngs;
}
var polyline = L.polyline(createRings(3), {color: generateRandomColor()}).addTo(map);