mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
529 stars 114 forks source link

Add wptIconsType & wptIconTypeUrls #91

Closed velocat closed 4 years ago

velocat commented 4 years ago

Set icon WPT by element "type" (category) if not "sum"

velocat commented 4 years ago

If you add a type to the marker, then later you can, for example, hang on the button enable / disable the display of WPT on the map, like this: .... .on('loaded', function(e) { allLayers = e.layers; }) .....

and use function: var trigg_view = true; changeViewWpt = function(){ if(trigg_view == true){ allLayers.eachLayer(function (layer) { if(layer.options.type == 'waypoint'){ layer.remove(); } }); trigg_view = false; }else{ allLayers.eachLayer(function (layer) { if(layer.options.type == 'waypoint'){ layer.addTo(mymap); } }); trigg_view = true; } }