Skip to content

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?

2 participants