Closed delitestudio closed 6 years ago
Absolutely!
This plugin fires an event for every marker/pin that is added to the map. When the start pin is added, you'll get a addpoint
event with a point_type: 'start'
in the event payload, as written at https://github.com/mpetazzoni/leaflet-gpx/blob/master/gpx.js#L339.
This event payload includes the pin object itself as the point
, and you can call .setZIndexOffset(...)
on it, as documented here: https://leafletjs.com/reference-1.3.0.html#marker-setzindexoffset
So you should be able to write something like this:
new L.GPX(url, {async: true}).on('addpoint', function(e) {
if (e.point_type === 'start') {
e.point.setZIndexOffset(1000);
}
}).addTo(map);
Thank you very much for your detailed answer!
Hello and thanks for this great plugin!
Is there a way to make sure the start pin is always above the other waypoints?