From: Keith Packard Date: Tue, 14 May 2013 07:38:34 +0000 (-0700) Subject: altosui: Use GPS alt + baro height for KML altitude X-Git-Tag: 1.2.1~8 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=bdea4c88318a41ade3d3b6b2cbfc097ae3e4f3be;hp=43f94e923a6a87520edcbb8fb4829e6ddf708908;p=fw%2Faltos altosui: Use GPS alt + baro height for KML altitude GPS altitude is generally more absolutely correct than baro altitude, so use that as the nominal pad altitude when generating a KML file. This results in a KML file that has the flight trace start and end closer to the ground, which is always nice. Signed-off-by: Keith Packard --- diff --git a/altosui/AltosKML.java b/altosui/AltosKML.java index 84f9dc7a..882fe0a9 100644 --- a/altosui/AltosKML.java +++ b/altosui/AltosKML.java @@ -26,6 +26,7 @@ public class AltosKML implements AltosWriter { PrintStream out; int state = -1; AltosRecord prev = null; + double gps_start_altitude; static final String[] kml_state_colors = { "FF000000", @@ -109,7 +110,7 @@ public class AltosKML implements AltosWriter { AltosGPS gps = record.gps; out.printf(kml_coord_fmt, gps.lon, gps.lat, - record.altitude(), (double) gps.alt, + record.height() + gps_start_altitude, (double) gps.alt, record.time, gps.nsat); } @@ -140,11 +141,9 @@ public class AltosKML implements AltosWriter { if (!started) { start(record); started = true; + gps_start_altitude = gps.alt; } - if (prev != null && - prev.gps.second == record.gps.second && - prev.gps.minute == record.gps.minute && - prev.gps.hour == record.gps.hour) + if (prev != null && prev.gps_sequence == record.gps_sequence) return; if (record.state != state) { state = record.state;