Skip to content

Code for the Plane Spotting with Software Defined Radio, CrateDB and Node.js talk

License

Notifications You must be signed in to change notification settings

crate/devrel-plane-spotting-with-cratedb

Repository files navigation

TODO README

Callsigns in the last hour:

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

About

Code for the Plane Spotting with Software Defined Radio, CrateDB and Node.js talk

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published