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

219
Views
leaflet polylines and bringtofront on overlapping lines

I have:

var lines = volLines[name];

where name is the name for a group of polylines, each 'lines' has a marker with "name" displayed where i do this:

.addTo(mymap).on('click', changeMapLineColour);

When I click on a marker that is associated for the group of polylines the lines all change colour. The problem I have is there are many other groups of polylines so sometimes the lines that I have change the colour of are under other groups of polylines so I cannot see all the lines. How do I bring the lines associated with "name" to the front when the lines overlap?

function changeMapLineColour()
{ //other stuff in here, just given basics for this problem.
   lines[i].setStyle({
                            color: "white",
                            weight: 4
                        }) 
}

I found this but I am unsure of how to use it and where to put in cshtml?

actions: {
  bringToFront(e) {
    e.target.bringToFront();
  }
}
{{polyline-layer ... onAdd=(action "bringToFront")}}

Or is there a better way?

Thank you!

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

0

created a layer (from an array of lines) like this to then be able to bringToFront()

var layer = lines[i].setStyle({
                    color: "white",
                    weight: 4
                })
                layer.bringToFront();

woohoo!

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!