mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
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.
16 lines
775 B
Elixir
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> |