Skip to content

This app is to track all aircrafts that passing onto a specified Bouding Box, store it, and alert an user if the flight doesn't respect flight rules

License

Notifications You must be signed in to change notification settings

francois-poidevin/flighttracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight Tracker

This app is to track all aircrafts that passing onto a specified Bouding Box, store it, and alert an user if the flight doesn't respect flight rules

Use cases

  • You think to buy a house, and you want to prevently check if your investissement will be under hight flight pressure
  • You want to know if a specific area have illegal flights (under altitude rules)

Informations

French reglementation

Guide_autorisation_survol_basses_hauteurs Definition - Unité urbaine / Agglomeration

API feed

Bbox construction

If you need to construct a bbox that fit with FlightTracker requierement, take a look in bboxfinder.com

Build

go build -o bin/flighttracker

or

docker build -t flighttracker:latest .

Configuration file

Generate

Generate a configuration file on local folder with default values

./bin/flighttracker config new > /configlocal/config_flighttracker.toml

You can change the configuration file for specifying configuration

###############################
# Flighttracker Settings 
###############################
[Flighttracker]

  # tracking bbox (Lat/Lon)
  bbox = "43.52,1.32^43.70,1.69"

  # refresh timing
  refresh = 5

  # the sinker Type use
  sinkertype = "DB"

  ###############################
  # postgres sinker configuration 
  ###############################
  [Flighttracker.postgres]

    # Postgres dbName
    dbName = "postgres"

    # Postgres host
    host = "172.17.0.2"

    # Postgres password
    password = "mysecretpassword"

    # Postgres port
    port = 5432

    # Postgres user
    user = "postgres"

  ###############################
  # file sinker configuration 
  ###############################
  [Flighttracker.file]

    # output raw file name
    outputraw = "rawData.log"

    # output report file name
    outputreport = "report.log"

###############################
# Logs Settings 
###############################
[Log]

  # Log level: debug, info, warn, error, dpanic, panic, and fatal
  level = "warn"

Explaination

Parameter Signification
Flighttracker.refresh Refresh timer (every n seconds)
Flighttracker.bbox BoundingBox where analyse is done (Bottom Left-Top Right)
Flighttracker.sinkerType Sinker type (STDOUT or FILE or DB)
Flighttracker.postgres.dbName Postgres Database Name
Flighttracker.postgres.host Postgres Database host
Flighttracker.postgres.password Postgres Database password
Flighttracker.postgres.port Postgres Database port
Flighttracker.postgres.user Postgres Database user
Flighttracker.file.outputraw File name for output raw for sinker type 'FILE'
Flighttracker.file.outputreport File name for output report for sinker type 'FILE'
Log Log level used

sinkerType

STDOUT

The sinker will display on Standard Output the raw data unmarshalled and unmarshalled data with criteria (flight under ...)

FILE

This sinker will create files on local folder where the application is running under 'log' folder. The rawData.log file store all unmarshalled data from raw json. The report.log file store only unmarshalled data with criteria (flight under ...)

DB

Pre-requisite
Docker
docker run -p 5432:5432 --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis

Database is accessible at <YOUR_LOCAL_DOCKER_IP>:5432

Local installation (Ubuntu 20.04)
  • Step 1: Update system
sudo apt update
sudo apt -y install vim bash-completion wget
sudo apt -y upgrade
sudo reboot
  • Step 2: Add PostgreSQL 12 repository
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
  • Step 3: Install PostgreSQL 12
sudo apt update
sudo apt -y install postgresql-12 postgresql-client-12
  • Step 4: Install Postgis extension
sudo su - postgres
psql -d postgres
postgres=# CREATE EXTENSION postgis;

Database is accessible at 127.0.0.1:5432

Informations

This sinker will create a database structure in postgres database (schema and table) This sinker will store inbound data to postgres database

Run

start service

The start CLI service allow to sink data in differents sinkers has: STDOUT, FILE, DB (POSTGRES)

Running flightTracker with default information of configuration file

./bin/flighttracker start --config ./configlocal/config_flighttracker.toml

or

docker run -v /home/poidevin/Projects/flighttracker/configlocal:/tmp flighttracker:latest start --config /tmp/config_flighttracker.toml

then call the endpoint on docker container IP (i.e. 172.17.0.1:8080)

startHttp service

The startHttp CLI service allow start a REST server on 8080 port to sink data in database (POSTGRES) and allow to request to the database

Running flightTracker with default information of configuration file

./bin/flighttracker startHttp --config ./configlocal/config_flighttracker.toml

or

docker run -v /home/poidevin/Projects/flighttracker/configlocal:/tmp -p 8080:8080 flighttracker:latest startHttp --config /tmp/config_flighttracker.toml

then call the endpoint on docker container IP (i.e. 172.17.0.1:8080)

endpoints

endpoint HTTP Methods example signification
/start GET localhost:8080/api/v1/start to start the sinking service on database
/stop GET localhost:8080/api/v1/stop to stop the sinking service on database
/search GET localhost:8080/api/v1/search?bbox=43.52,1.32^43.70,1.69&altThresholdFeet=500&fromTimeStamp=2021-07-22T09:00:00&toTimeStamp=2021-07-24T12:00:00 to search data from database on several criteria as path parameters
start

To start the sinking service on database

stop

To stop the sinking service on database

search
path parameters signification
bbox BoundingBox where analyse is done (Bottom Left-Top Right)
altThresholdFeet floor threshold for research in Feet unit. Only above and equals data will be returned
fromTimeStamp from time windows for search
toTimeStamp to time windows for search

Docker images

  • Storing data

Postgis dockerHub image

FROM postgis/postgis
  • worker

Golang dockerHub image

FROM golang:alpine

Docker compose - not yet implemented

Airport area

For excluding illegal flights onto airport area, we will use overpass QL to request OSM API to generate polygon of each airport in France

Overpass

Play the overpass QL script on Overpass-turbo

Overpass QL

[out:json][timeout:600];
// gather results
(
  // query part for: “aeroway=aerodrome”
  node["aeroway"="aerodrome"]({{bbox}});
  way["aeroway"="aerodrome"]({{bbox}});
  relation["aeroway"="aerodrome"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

osmtogeojson

To generate OSM data to geojson osmtogeojson

About

This app is to track all aircrafts that passing onto a specified Bouding Box, store it, and alert an user if the flight doesn't respect flight rules

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages