I would like that when I add a gpx file in my input, it is taken into account and displayed on the map.
Apparently I saw that it was necessary to convert the gpx file in format to geojson then to send this variable in the code data in map.addsource. But I can't get the gpx and convert it automatically to geojson for the moment.
Can you help me?
The map control only understands GeoJSON, vector tiles, and raster tiles. So in order to display GPX data, you would need to convert it to one of these types. GeoJSON is likely the best option here unless you have a massive GPX file (hundreds of MB) at which point vector tiles would be the right choice. To convert GPX to GeoJSON in a web app, use this library: https://github.com/mapbox/togeojson
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.