summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-14 00:38:34 -0700
committerKeith Packard <keithp@keithp.com>2013-05-14 00:38:34 -0700
commitbdea4c88318a41ade3d3b6b2cbfc097ae3e4f3be (patch)
treef947d53b3d7e7eb899c1a2a57a3d98fa2552ab35 /altosui
parent43f94e923a6a87520edcbb8fb4829e6ddf708908 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosKML.java9
1 files 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;