I'm working on a web mapping project with openlayers (a JavaScript API for web GIS) and I need to make an option for users to get .gpx Export from the coordinates that they have been there before.
I am making an option to export TXT with a JavaScript API.
Is there any API to convert my TXT to GPX?
Is there a different method for exporting GPX files?
Sure that's possible with OpenLayers 3. You dont need to create an TXT first and then convert it to the GPX. In OpenLayers 3 there is a function called ol.format.GPX()
which will convert your features to a gpx format. With writeFeatures()
you can add you features to the ol gpx object. Here is a working JS FIDDLE.