Filter out ground positions.

This commit is contained in:
John Wiseman 2020-05-09 14:28:04 -07:00
parent e1da356608
commit 919cbd7faa

View File

@ -35,13 +35,17 @@
(defn parse-adsbexchange-ac-element [e] (defn parse-adsbexchange-ac-element [e]
(let [nilstr #(if (= % "") nil %) (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")) {:postime (numstr (e "postime"))
:lat (numstr (e "lat")) :lat (numstr (e "lat"))
:lon (numstr (e "lon")) :lon (numstr (e "lon"))
:icao (e "icao") :icao (e "icao")
:registration (nilstr (e "reg")) :registration (nilstr (e "reg"))
:alt (numstr (e "alt")) :alt (numstr (e "alt"))
:gnd? (boolstr (e "gnd"))
:mlat? (= (e "mlat") "1") :mlat? (= (e "mlat") "1")
:speed (numstr (e "spd")) :speed (numstr (e "spd"))
:squawk (nilstr (e "sqk")) :squawk (nilstr (e "sqk"))
@ -195,7 +199,8 @@
(defn circling? [ac config] (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))) (> (:alt ac) 300)))