Write geojson of each track.
This commit is contained in:
parent
4573e421d5
commit
ac56fb0b61
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
out
|
out
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
secrets.yaml
|
||||||
|
@ -158,3 +158,12 @@ more than once every 10 seconds.
|
|||||||
|
|
||||||
* **Do not run the script more often than once every 10 seconds, or
|
* **Do not run the script more often than once every 10 seconds, or
|
||||||
adsbexchange.com will ban your IP.**
|
adsbexchange.com will ban your IP.**
|
||||||
|
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
To run a test watcher:
|
||||||
|
|
||||||
|
```
|
||||||
|
npx shadow-cljs watch script test
|
||||||
|
```
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
(logging/deflog "circlebot" logger)
|
(logging/deflog "circlebot" logger)
|
||||||
|
|
||||||
|
|
||||||
(defn get-basestation-sqb-record [icao db-path]
|
(defn get-basestation-sqb-record [icao db-path]
|
||||||
(log-info "%s: Looking up in %s" icao db-path)
|
(log-info "%s: Looking up in %s" icao db-path)
|
||||||
(p/let [record
|
(p/let [record
|
||||||
@ -455,13 +454,18 @@
|
|||||||
(= (get-in coarse [:properties :name]) "California"))
|
(= (get-in coarse [:properties :name]) "California"))
|
||||||
(log-info "%s: Filtering out because it is outside Los Angeles County" (:icao ac))
|
(log-info "%s: Filtering out because it is outside Los Angeles County" (:icao ac))
|
||||||
(if (and image-path description)
|
(if (and image-path description)
|
||||||
(if (get-in config [:twitter :enabled?])
|
(do
|
||||||
(twitter/tweet (twitter/twit (:twitter config))
|
(if (get-in config [:twitter :enabled?])
|
||||||
description
|
(twitter/tweet (twitter/twit (:twitter config))
|
||||||
[image-path]
|
description
|
||||||
lat
|
[image-path]
|
||||||
lon)
|
lat
|
||||||
(log-warn "Skipping tweeting"))
|
lon)
|
||||||
|
(log-warn "Skipping tweeting"))
|
||||||
|
(let [path (str (.toFixed (/ now 1000) 0) "-" icao ".geojson")]
|
||||||
|
(util/write-file path (.stringify
|
||||||
|
js/JSON
|
||||||
|
(clj->js (util/->geojson recent-positions icao centroid))))))
|
||||||
(log-warn "Skipping tweet %s %s" image-path description)))))))))))
|
(log-warn "Skipping tweet %s %s" image-path description)))))))))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,3 +85,59 @@
|
|||||||
[[k]])))
|
[[k]])))
|
||||||
m))
|
m))
|
||||||
[]))
|
[]))
|
||||||
|
|
||||||
|
|
||||||
|
;; "type": "FeatureCollection",
|
||||||
|
;; "features": [
|
||||||
|
;; {
|
||||||
|
;; "type": "Feature",
|
||||||
|
;; "properties": {},
|
||||||
|
;; "geometry": {
|
||||||
|
;; "type": "LineString",
|
||||||
|
;; "coordinates": [
|
||||||
|
;; [
|
||||||
|
;; -118.27262878417969,
|
||||||
|
;; 33.920001740102585
|
||||||
|
;; ],
|
||||||
|
;; [
|
||||||
|
;; -118.2176971435547,
|
||||||
|
;; 33.946777683283706
|
||||||
|
;; ],
|
||||||
|
;; ]
|
||||||
|
;; }
|
||||||
|
;; },
|
||||||
|
;; {
|
||||||
|
;; "type": "Feature",
|
||||||
|
;; "properties": {
|
||||||
|
;; "marker-color": "#7e7e7e",
|
||||||
|
;; "marker-size": "medium",
|
||||||
|
;; "marker-symbol": "",
|
||||||
|
;; "ICAO": "AE0000"
|
||||||
|
;; },
|
||||||
|
;; "geometry": {
|
||||||
|
;; "type": "Point",
|
||||||
|
;; "coordinates": [
|
||||||
|
;; -118.17649841308594,
|
||||||
|
;; 33.99176508196857
|
||||||
|
;; ]
|
||||||
|
;; }
|
||||||
|
;; }
|
||||||
|
;; ]
|
||||||
|
;; }
|
||||||
|
|
||||||
|
(defn ->geojson [positions icao centroid]
|
||||||
|
{:type "FeatureCollection"
|
||||||
|
:features
|
||||||
|
[{:type "Feature"
|
||||||
|
:properties {}
|
||||||
|
:geometry
|
||||||
|
{:type "LineString"
|
||||||
|
:coordinates (map (fn [pos] [(:lon pos) (:lat pos)]) positions)}}
|
||||||
|
{:type "Feature"
|
||||||
|
:properties {:marker-color "#7e7e7e"
|
||||||
|
:marker-size "medium"
|
||||||
|
:marker-symbol ""
|
||||||
|
:ICAO icao}
|
||||||
|
:geometry {:type "Point"
|
||||||
|
:coordinates [(:lon centroid) (:lat centroid)]}}]})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user