https://github.com/crate/devrel-plane-spotting-with-cratedb
Code for the Plane Spotting with Software Defined Radio, CrateDB and Node.js talk
https://github.com/crate/devrel-plane-spotting-with-cratedb
Last synced: 11 months ago
JSON representation
Code for the Plane Spotting with Software Defined Radio, CrateDB and Node.js talk
- Host: GitHub
- URL: https://github.com/crate/devrel-plane-spotting-with-cratedb
- Owner: crate
- License: mit
- Created: 2024-06-14T16:11:07.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-27T13:16:03.000Z (over 1 year ago)
- Last Synced: 2025-07-19T07:15:12.602Z (12 months ago)
- Language: JavaScript
- Size: 65.4 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TODO README
Interested in learning more about this probject? There's a full explanation and demo in [this video on YouTube](https://www.youtube.com/watch?v=YIUJTbrwlAs).
Callsigns in the last hour:
```sql
select plane_id, callsign from planespotting.radio_messages where callsign is not null and ts >= now() - interval '1 hour';
```
Latest data for planes that have a plane_id, callsign, altitude and position and updated in the last 2 minutes:
```
SELECT plane_id, callsign, (CURRENT_TIMESTAMP - latest_ts) as last_update, altitude, distance('POINT (-1.1436530095627766 52.94765937629119)', position) / 1000 as distance, position from (
select plane_id,
(select callsign from planespotting.radio_messages where plane_id = planes.plane_id and callsign is not null order by ts desc limit 1) as callsign,
(select altitude from planespotting.radio_messages where plane_id = planes.plane_id and altitude is not null order by ts desc limit 1) as altitude,
(SELECT position from planespotting.radio_messages where plane_id = planes.plane_id and position is not null order by ts desc limit 1) as position,
(SELECT ts from planespotting.radio_messages where plane_id = planes.plane_id order by ts desc limit 1) as latest_ts
from (select distinct plane_id from planespotting.radio_messages) as planes
) as interesting_planes WHERE latest_ts >= current_timestamp - '2 mins'::interval and plane_id is not null and callsign is not null and altitude is not null and position is not null order by last_update ASC;
```
Grafana: https://cratedb.com/docs/guide/integrate/visualize/grafana.html