mapbox / leaflet-omnivore

universal format parser for Leaflet & Mapbox.js
https://www.mapbox.com/mapbox.js/example/v1.0.0/omnivore-gpx/
Other
651 stars 126 forks source link

Show icon to mark start and end of each .gpx #82

Closed PedroF20 closed 7 years ago

PedroF20 commented 8 years ago

I'm using Omnivore to run through a directory of .gpx files, and I need to mark where is the start and end of each track.

I was using this:

              for (var i = 0; i < jsonRes.length; i += 1) {
                var runLayer = omnivore.gpx(folderPath + jsonRes[i], null, customLayer)
                  .on('ready', function() {
                      //runLayer.showExtremities('arrowM');
                  })
                  .addTo(trackmaps[trackmapCount])
                  .on('click', function(d) {
                      console.log(d);
                  });
              }

But that showExtremities function (plugin - https://github.com/makinacorpus/Leaflet.LineExtremities) makes the map slow, because for whatever reason draws not only on the start and end of each track. Is there any solution for this problem?

tmcw commented 7 years ago

Using the plugin you mentioned would be the best technique - leaflet-omnivore doesn't and shouldn't include any style-related code.