From 919cbd7faa513f85b1ea51fd0e1c03ae2e9faab3 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Sat, 9 May 2020 14:28:04 -0700 Subject: [PATCH] Filter out ground positions. --- src/main/lemondronor/advisorycircular.cljs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/lemondronor/advisorycircular.cljs b/src/main/lemondronor/advisorycircular.cljs index 0e8ef37..3415a29 100644 --- a/src/main/lemondronor/advisorycircular.cljs +++ b/src/main/lemondronor/advisorycircular.cljs @@ -35,13 +35,17 @@ (defn parse-adsbexchange-ac-element [e] (let [nilstr #(if (= % "") nil %) - numstr #(if (= % "") nil (js/parseFloat %))] + numstr #(if (= % "") nil (js/parseFloat %)) + boolstr #(if (or (= % "1") (= (string/lower-case %) "true")) + true + false)] {:postime (numstr (e "postime")) :lat (numstr (e "lat")) :lon (numstr (e "lon")) :icao (e "icao") :registration (nilstr (e "reg")) :alt (numstr (e "alt")) + :gnd? (boolstr (e "gnd")) :mlat? (= (e "mlat") "1") :speed (numstr (e "spd")) :squawk (nilstr (e "sqk")) @@ -195,7 +199,8 @@ (defn circling? [ac config] - (and (> (geo/flight-curviness (:history ac)) (:curviness-threshold-degrees config)) + (and (> (geo/flight-curviness (filter #(not (:gnd? %)) (:history ac))) + (:curviness-threshold-degrees config)) (> (:alt ac) 300)))