Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
254 stars 82 forks source link

How to load geojson tracks in `L.GpxGroup` library? #225

Closed brigghius closed 1 year ago

brigghius commented 1 year ago

Your environment

hi, I'm developing a multi track map and I'm using the example here because it's very nice and does what I want.

To load the tracks we use an array of strings pointing to files. How can I make it work on an object present in my ts file?

track: any = {
    "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
            }
        }
    ]
}

thanks

brigghius commented 1 year ago

@Raruto can u help me?

hupe13 commented 1 year ago

As I understand it, each track must be in one file. Geojson should be fine. And you must provide the starting points. But I don't know angular.

brigghius commented 1 year ago

As I understand it, each track must be in one file. Geojson should be fine. And you must provide the starting points. But I don't know angular.

exactly. To load the traces as an array of objects and not as an array of strings pointing to files, I had to put the library locally and modify it like this:

image

Is it possible to dynamically load a new point on a track?

Raruto commented 1 year ago

@brigghius it should look something like the following https://github.com/Raruto/leaflet-elevation/pull/228, please test more thoroughly than me (eg. the geojson name) and then let me know if we need to make any changes.

Have a nice day, Raruto

brigghius commented 1 year ago

@brigghius it should look something like the following #228, please test more thoroughly than me (eg. the geojson name) and then let me know if we need to make any changes.

Have a nice day, Raruto

thanks, now works fine. I had bypassed the check on the object, but the solution is excellent.