Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling of GPX files with multiple tracks #123

Open
chrisrummel opened this issue Aug 5, 2021 · 1 comment
Open

handling of GPX files with multiple tracks #123

chrisrummel opened this issue Aug 5, 2021 · 1 comment

Comments

@chrisrummel
Copy link

chrisrummel commented Aug 5, 2021

Although multiple tracks within one GPX file is supported and all tracks are marked with their own start- and end-markers, only the name of the first track is displayed as the title and only one checkbox for de-selecting all included tracks individually is shown in the box in the upper right corner.

While it is necessary to reduce all included track-names to one name for the title and to create a sum of all included distances etc., it would be nice to at least list the included tracks individually in the box in the upper right corner, and then maybe update the data at the bottom.

Edit:
I am no programmer, but as far as I can read and understand the source, I found this:

  • in line 329 the name of the first track gets selected, as are other infos in the next lines. No matter how many tracks, only track no. "0".
  • in line 353 the complete gpx file is parsed and gets iterated through all included tracks, segments get concatenated.

If I knew how to do it, I would try to do this:

  • when creating the L.GPX layer not only pass "url" but additionally an index counter to return only one specific track to the layer.
  • then creating one layer per track by iterating through all tracks by looping through index counter.
  • adding all L.GPX-layers to the control-overlay.

I am sorry if this is complete fantasy nonsense, but not being a programmer this is as good as I can describe it.

jeromectm added a commit to jeromectm/leaflet-gpx that referenced this issue Apr 21, 2022
As suggested by mpetazzoni#123, added a "trackNumber" option to return a single track, when the gpx file contains multiple ones. The name, desc etc are then returned from this track. Also added get_number_of_tracks() to count the tracks.
@mpetazzoni mpetazzoni reopened this Feb 23, 2023
@mpetazzoni
Copy link
Owner

Added support for styling routes/tracks differently. I'll work on styling markers separately, and route/track visibility next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants