Added altitude to geojson.

This commit is contained in:
John Wiseman 2020-05-09 13:43:05 -07:00
parent 79e675b263
commit 3e840690be
3 changed files with 18 additions and 2 deletions

View File

@ -443,7 +443,9 @@
:properties props :properties props
:geometry :geometry
{:type "LineString" {:type "LineString"
:coordinates (map (fn [pos] [(:lon pos) (:lat pos)]) coords)}}) :coordinates (map (fn [pos]
[(:lon pos) (:lat pos) (util/feet-to-meters (:alt pos))])
coords)}})
(defn track->geojson [older-positions recent-positions icao centroid] (defn track->geojson [older-positions recent-positions icao centroid]

View File

@ -49,6 +49,16 @@
selector)) selector))
(defn tar1090-url [icao options]
(let [url (gstring/format
"https://tar1090.adsbexchange.com/?icao=%s&zoom=%s&noIsolation&hideButtons&hideSidebar"
icao
(or (:zoom options) 14))]
(if (:simple-tracks options)
(str url "&monochromeMarkers=ffff55&monochromeTracks=010101&outlineColor=505050")
url)))
(defn screenshot-aircraft (defn screenshot-aircraft
([icao lat lon] ([icao lat lon]
(screenshot-aircraft icao lat lon {})) (screenshot-aircraft icao lat lon {}))
@ -72,7 +82,7 @@
(if-let [user-agent (:user-agent options)] (if-let [user-agent (:user-agent options)]
(.setUserAgent page user-agent)) (.setUserAgent page user-agent))
(log-debug "Navigating") (log-debug "Navigating")
(let [url (gstring/format "https://tar1090.adsbexchange.com/?icao=%s&zoom=%s&noIsolation&hideButtons&hideSidebar&monochromeMarkers=ffff55&monochromeTracks=010101&outlineColor=505050" icao (or (:zoom options) 14))] (let [url (tar1090-url icao options)]
(log-info "Getting screenshot at url %s with zoom %s" url (or (:zoom options) 14)) (log-info "Getting screenshot at url %s with zoom %s" url (or (:zoom options) 14))
(p/all [(.waitForNavigation page) (p/all [(.waitForNavigation page)
(.goto page (.goto page

View File

@ -97,3 +97,7 @@
(.getUTCMinutes date) (.getUTCMinutes date)
(.getUTCSeconds date) (.getUTCSeconds date)
(.getUTCMilliseconds date)))) (.getUTCMilliseconds date))))
(defn feet-to-meters [f]
(* f 0.3048))