Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
255 stars 85 forks source link

waypoints in gpx, get the track name #158

Closed hupe13 closed 3 years ago

hupe13 commented 3 years ago

Hi Raruto,

if a gpx track contains waypoints (wpt), the name of tooltip was the name of the first waypoint. This pull request makes the name of the (first) track to the name of the tooltip.

This code removes the waypoints from map:

map.on("zoomend", function(e) {
     map.eachLayer(function(layer) {
    if (layer instanceof L.Marker) {
        map.removeLayer(layer);
    }
    });
});

I could not solve it any other way.

Raruto commented 3 years ago

This code removes the waypoints from map:

map.on("zoomend", function(e) {
     map.eachLayer(function(layer) {
  if (layer instanceof L.Marker) {
      map.removeLayer(layer);
  }
    });
});

I could not solve it any other way.

@hupe13 take a look at https://leafletjs.com/reference#geojson-filter

hupe13 commented 3 years ago

How do I filter L.GpxGroup?

Raruto commented 3 years ago

https://github.com/Raruto/leaflet-elevation/blob/fd739db55b147b864b79c41428757373551f59b7/libs/leaflet-gpxgroup.js#L232

Otherwise you can add a dedicated option if you want.

hupe13 commented 3 years ago

Thank you very much, it works.