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

Unsopperted GeoJSON feature geometry type:Point #275

Open luisfio1 opened 10 months ago

luisfio1 commented 10 months ago

In your example loading a local GPX.file the way points are apparently not supported.

I have tried to add the points with the options:

waypoints: true,
wptLabels: true,

but it doesn't seem to accept them.

This is the message that appears in the console:

"control.js:328 Unsopperted GeoJSON feature geometry type:Point"

Is there any option to include them?

Thanks

Raruto commented 10 months ago

Hi @luisfio1,

this is issue somehow related to: https://github.com/Raruto/leaflet-elevation/issues/273#issuecomment-1777340192


In your example loading a local GPX.file the way points are apparently not supported.

This is the message that appears in the console:

"control.js:328 Unsopperted GeoJSON feature geometry type:Point"

Is there any option to include them?

that example make use of the addData() function which is a bit lower level in the execution flow than the load() function:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_upload-gpx.html#L138-L140

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L327-L328

I have tried to add the points with the options:

waypoints: true,
wptLabels: true,

but it doesn't seem to accept them.

That's where they are currently in use:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L784-L805

For your convenience, I recommend that you take some functions such as _loadLayer() as a reference and alter them to your liking (it is nothing more than utility function for build a standard L.GeoJSON object).

Then (within the example) you can insert your customization from here 👇

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_upload-gpx.html#L138-L140

Or at least I'd start experimenting from there..

👋 Raruto