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

Add support for geojson tracks in L.GpxGroup library #228

Merged
merged 1 commit into from
May 16, 2023

Conversation

Raruto
Copy link
Owner

@Raruto Raruto commented Dec 17, 2022

Close: #225


How to use

Ref: #225 (comment)

let tracks = [
  // a string pointing to a gpx file (URL)
  "tracks/20131006.gpx",
  "tracks/20131110.gpx",

  // a geojson object track (feature collection)
  {
    "type": "FeatureCollection",
    "features": [{
      "type": "Feature",
      "geometry": {
        "type": "MultiLineString",
        "coordinates": [
          [
            [
              18.8793834,
              47.5757454,
              336.399
            ],
            [
              18.879521,
              47.5757001,
              336.243
            ],
            [
              18.879616,
              47.575628,
              336.476
            ],
            [
              18.8798517,
              47.5755253,
              338.85
            ],
            [
              18.8801746,
              47.5753281,
              337.622
            ],
            [
              18.8803667,
              47.5751841,
              335.793
            ],
            [
              18.8806468,
              47.5750652,
              334.178
            ]
          ]
        ]
      },
      "properties": {
        "name": "2013/10/06 - Bronz-barlang, Karády-lak, festékföld égető kemencék",
        "number": 1
      }
    }]
  },

  // another geojson object track (feature collection)
  {
    "type": "FeatureCollection",
    "features": [{
      "type": "Feature",
      "geometry": {
        "type": "MultiLineString",
        "coordinates": [
          [
            [
              18.8793834,
              47.5757454,
              336.399
            ],
            [
              18.879521,
              47.5757001,
              336.243
            ],
            [
              18.879616,
              47.575628,
              336.476
            ],
            [
              18.8798517,
              47.5755253,
              338.85
            ],
            [
              18.8801746,
              47.5753281,
              337.622
            ],
            [
              18.8803667,
              47.5751841,
              335.793
            ],
            [
              18.8806468,
              47.5750652,
              334.178
            ]
          ]
        ]
      },
      "properties": {
        "name": "2013/10/06 - Bronz-barlang, Karády-lak, festékföld égető kemencék",
        "number": 1
      }
    }]
  }

];


routes = L.gpxGroup(tracks, gpxGroupOpts });

@Raruto Raruto changed the title Add support for geojson tracks in libs/leaflet-gpxgroup.js Add support for geojson tracks in L.GpxGroup library Dec 17, 2022
@Raruto Raruto merged commit 9509750 into master May 16, 2023
@Raruto Raruto deleted the lib-gpxgroup-geojson-track branch May 16, 2023 15:31
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

Successfully merging this pull request may close these issues.

How to load geojson tracks in L.GpxGroup library?
1 participant