Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

72
Views
Leaflet Multipolyline with dynamic rings

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!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!