From bdea4c88318a41ade3d3b6b2cbfc097ae3e4f3be Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 14 May 2013 00:38:34 -0700 Subject: [PATCH] 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 --- altosui/AltosKML.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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; -- 2.30.2