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

Problem with displaying a large track (multitrack) #176

Closed wpysz closed 2 years ago

wpysz commented 2 years ago

Starting with leaflet-elevation@1.6.0 no large GPX files are displayed. For version 1.5.6, everything worked fine. All subsequent versions, up to 1.7.6, have a problem with displaying a track larger than 1-1.5 MB.

My environment

B/ leaflet-elevation 1.7,6 - track GPX 1 MB (It's good ) https://ciekawe.tematy.net/testy/raruto/156/test-1.7.6-1mb.html

C/ leaflet-elevation 1.7,6 - track GPX 3 MB (There is no track or graph; also for 1.6.0, 1.6.1, etc. ) https://ciekawe.tematy.net/testy/raruto/156/test-1.7.6-3mb.html

JS script

The JS script is identical in all examples, the name of the GPX file differs.

var opts = {
  map: {
    center: [48.32, 24.67],zoom: 10,
  },
  elevationControl: {
    url: "https://ciekawe.tematy.net/testy/raruto/156/track-3MB.gpx",
    options: {
      downloadLink: false,
      legend: false,
    },
  },
};
var map = L.map('map', opts.map);
var controlElevation = L.control.elevation(opts.elevationControl.options);
controlElevation.addTo(map);
controlElevation.load(opts.elevationControl.url);
velocat commented 2 years ago

Hi, your track consists of two segments. If you make it single-segment, it will be displayed normally

From Line #7112:

<trkpt lat="48.2556360" lon="24.5391436">
  <ele>1000.190979</ele>
  <time>2021-08-03T11:45:01.000Z</time>
</trkpt>

</trkseg> <-- Delete this
<trkseg> <-- Delete this

<trkpt lat="48.2556003" lon="24.5392026">
  <ele>1000.763000</ele>
  <time>2021-08-03T11:47:49.000Z</time>
</trkpt>

<trkpt lat="48.2555780" lon="24.5392720">

The problem with multitracks is still relevant: #56

wpysz commented 2 years ago

Thanks. I didn't come up with this because I rarely create multi-segment tracks. After changing the file, it is already displayed. https://ciekawe.tematy.net/testy/raruto/156/test-1.7.6-3mb-1seg.html