2019-12-14 05:37:19 +00:00
|
|
|
# Advisory Circular
|
|
|
|
|
2019-12-14 07:59:13 +00:00
|
|
|
This is a twitter bot that alerts you when any aircraft is circling.
|
2019-12-14 08:24:00 +00:00
|
|
|
You can see it in action at
|
|
|
|
[@SkyCirclesLA](https://twitter.com/SkyCirclesLA).
|
2019-12-14 07:59:13 +00:00
|
|
|
|
2019-12-14 07:59:58 +00:00
|
|
|
![Example tweet](Screen Shot 2019-12-13.png?raw=true "Example tweet")
|
2019-12-14 07:59:13 +00:00
|
|
|
|
|
|
|
|
2019-12-14 08:24:00 +00:00
|
|
|
## Prerequisites to running the bot
|
|
|
|
|
|
|
|
**Set up a Pelias instance containing information for the geographical
|
|
|
|
area you're interested in.** See https://github.com/pelias/docker and
|
|
|
|
if you're lucky the `projects` folder will have a predefined project
|
|
|
|
that covers the area you want. I run one using the `los-angeles-metro`
|
|
|
|
project.
|
|
|
|
|
|
|
|
**Get an API key for adsbexchange.com.** See
|
|
|
|
https://www.adsbexchange.com/data/ If you have a receiver and feed
|
|
|
|
them data, they'll give you a key for free. Alternately, find another
|
|
|
|
data source of realtime (or not) aircraft data and massage it into a
|
|
|
|
form that the bot can work with.
|
|
|
|
|
|
|
|
**Get access keys for a twitter account.** Follow the [instructions at
|
|
|
|
botwiki](https://botwiki.org/tutorials/how-to-create-a-twitter-app/).
|
|
|
|
|
|
|
|
|
|
|
|
## Running the bot
|
|
|
|
|
|
|
|
Put your adsbexchange.com API key and twitter keys in `secrets.yaml`.
|
|
|
|
|
2019-12-14 08:28:27 +00:00
|
|
|
Create an initial history database:
|
|
|
|
|
|
|
|
`echo '{}' > advisory-circular.db`
|
2019-12-14 08:24:00 +00:00
|
|
|
|
|
|
|
Install node dependencies:
|
|
|
|
|
|
|
|
`npm install`
|
|
|
|
|
|
|
|
Compile the clojurescript:
|
|
|
|
|
|
|
|
`npx shadow-cljs compile script`
|
|
|
|
|
|
|
|
Run the bot:
|
|
|
|
|
|
|
|
`node out/script.js --url https://adsbexchange.com/api/aircraft/json --lat <lat> --lon <lon> --radius <radius>;`
|
|
|
|
|
|
|
|
Specify your geographical region of interest by specifying a circle at
|
|
|
|
`<lat>`, `<lon>` with a radius of `<radius>` miles.
|
|
|
|
|
|
|
|
The bot will run once. The adsbexchange.com API only provides
|
|
|
|
instantaneous positions, so the bot will have to run many times and
|
|
|
|
collect some history before it's able to detect any circles.
|
|
|
|
|
|
|
|
```
|
|
|
|
while :
|
|
|
|
do
|
|
|
|
node out/script.js --url https://adsbexchange.com/api/aircraft/json --lat <lat> --lon <lon> --radius <radius>
|
|
|
|
sleep 10
|
|
|
|
done
|
|
|
|
```
|
|
|
|
|
2019-12-14 08:28:27 +00:00
|
|
|
* **Do not run the script with a large radius, or adsbexchange.com will
|
|
|
|
ban your IP.** I use a radius of 40 miles.
|
2019-12-14 08:24:00 +00:00
|
|
|
|
2019-12-14 08:28:27 +00:00
|
|
|
* **Do not run the script more ofen than once every 10 seconds, or
|
|
|
|
adsbexchange.com will ban your IP.**
|
2019-12-14 08:24:00 +00:00
|
|
|
|
|
|
|
|
2019-12-14 07:59:13 +00:00
|
|
|
## To do
|
|
|
|
|
2019-12-14 08:24:00 +00:00
|
|
|
- [ ] If we don't have neighbourhood or locality (just county), try to
|
|
|
|
use the locality of a nearby venue. E.g. "2 miles from
|
|
|
|
Glendale."
|
|
|
|
- [ ] Solve the issue of needing a differently sized buffer zone for
|
|
|
|
different airports--2 miles distance from LAX is still
|
|
|
|
practically inside the aiport. Add list with custom airport
|
|
|
|
coords and radii? Get access to OSM polygons and compute our own
|
|
|
|
distances?
|
|
|
|
- [ ] Lookup registration info. Possible sources: FAA,
|
|
|
|
adsbexchange.com, janky-ass basestation.sqb's that have been
|
|
|
|
passed around for a decade.
|
|
|
|
- [ ] Add type information to tweet status, e.g. "Eurocopter AS350".
|
|
|
|
- [ ] Use Wikipedia graph to rank landmarks? More inbound links to a
|
2019-12-14 08:28:27 +00:00
|
|
|
page means it has higher significance?
|
2019-12-14 08:24:00 +00:00
|
|
|
- [ ] Add support for Mastodon/ActivityPub.
|
|
|
|
- [ ] Generate our own maps instead of using adsbx's? The adsbx map
|
|
|
|
isn't always in sync with the data from the API.
|
|
|
|
- [ ] Run at global scale!
|