mpetazzoni / leaflet-gpx

A GPX track plugin for Leaflet.js
http://mpetazzoni.github.io/leaflet-gpx
BSD 2-Clause "Simplified" License
545 stars 118 forks source link

Impossible to load not well-formed GPX #69

Closed VladimirKalachikhin closed 6 years ago

VladimirKalachikhin commented 6 years ago

I want to show on the map a GPX, which is being recorded right now. This GPX does not have closing tags, of course. So I have a "XML Parsing Error: no root element found".

mpetazzoni commented 6 years ago

I don't think handling this use case necessarily belongs at this layer. You should be feeding correct GPX data to leaflet-gpx, for example by concatenating the appropriate closing tags before passing the GPX content in:

var gpx = '...'; // assuming you're accumulating GPX data into this string
new L.GPX(gpx + '</trkseg></trk></gpx>', ...);
VladimirKalachikhin commented 6 years ago

Yes, of course. But on this case I have to get the GPX file myself.

If I need to display currently recorded track - is there a way to add new nodes to loaded GPX?

mpetazzoni commented 6 years ago

How do you access the GPX data?

VladimirKalachikhin commented 6 years ago

Via php. (I don't understand if you see the answer in the mail)