GPX output now contains elevation and UTC time

This commit is contained in:
Jan-Piet Mens 2016-02-09 09:00:31 +01:00
parent 291c920e99
commit d9cfb035b8

View File

@ -999,7 +999,8 @@ char *gpx_string(JsonNode *location_array)
// <trkpt lat="xx.xxx" lon="yy.yyy"> <!-- Attribute des Trackpunkts --> </trkpt>
json_foreach(one, location_array) {
double lat = 0.0, lon = 0.0;
double lat = 0.0, lon = 0.0, alt = 0.0;
char *isotst = "";
JsonNode *j;
if ((j = json_find_member(one, "lat")) != NULL) {
@ -1010,7 +1011,14 @@ char *gpx_string(JsonNode *location_array)
lon = j->number_;
}
utstring_printf(xml, " <trkpt lat='%lf' lon='%lf' />\n", lat, lon);
if ((j = json_find_member(one, "alt")) != NULL) {
alt = j->number_;
}
if ((j = json_find_member(one, "isotst")) != NULL) {
isotst = j->string_;
}
utstring_printf(xml, " <trkpt lat='%lf' lon='%lf'><ele>%.2f</ele><time>%s</time></trkpt>\n", lat, lon, alt, isotst);
}
utstring_printf(xml, "%s", " </trkseg>\n</trk>\n</gpx>\n");