Files
archived-hipudding-teslamate/lib/teslamate_web/templates/drive/gpx.xml.eex
Martin Hüser 8377f361ce fix gpx format (#2925)
some tools, e.g. Garmin Basecamp, expect a proper namespace
definition in the xml root element and are more sensitive to
xml schema violations.

Track point elevation is specified to be an element of type
xsd:decimal in the gpx schema. But Teslamate renders an
empty element <ele></ele> when no elevation data is present.
This fix does not render an <ele> element when no elevation
is present

Also the gpx schema requires a "creator" attribute on the
gpx root element.
2023-01-13 14:00:36 +01:00

16 lines
775 B
Elixir

<?xml version="1.0"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="Teslamate" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
<name><%= DateTime.to_iso8601(@drive.start_date) %></name>
<trkseg>
<%= for position <- @drive.positions do %>
<trkpt lat="<%= position.latitude %>" lon="<%= position.longitude %>">
<%= if not is_nil(position.elevation) do %>
<ele><%= position.elevation %></ele>
<% end %>
<time><%= DateTime.to_iso8601(position.date) %></time>
</trkpt>
<% end %>
</trkseg>
</trk>
</gpx>