FlightAware Discussions

Dump1090 MySQL Database Script with Alert and Filter


team - - does anybody have an idea, if/how it is possible to recalculate from hex_ICAO out of dump1090 (e.g. hex [3c6570] -->) to the aircraft type A333 … :: see: List of ICAO


would love to see the aircraft-type in my generated list - e.g. :

! you have to think from “top-right” to “bottom-left”- what makes sense! this was my missinterpretation of the skript! thanks for advise once more –


thanks TomMuc … was not able to find a basestation-DB, where i have been able to import.
e.g. https://data.flightairmap.com/

… loocks to be one of the biggest secrets in the plane-spotter scene :tired_face:
…as also direct DB/json exchange is not wanted/possible : only a manual synch over https://www.planespotters.net/ or http://www.airframes.org/

or do you have any other hint in hands?


hey zms - how to install etc. i have no time at the moment to guide you. but you can send me a pm with your email and i’ll send you the latest basestation.sqb.



Anyone who have a new radar.php for the new aircraft.json as used by dump1090-fa?

Variables in:

After I updated dump to version ver 1.15~dev nothing is written to the database.

I would also like that the records will send to the database without looking at the coordinates only the altitude of the aircraft.


dump1090-fa is not dump1090-mutability.
If you need the changes just scroll up and read my conversation with ZMS it should help you.
(this is the changes to radar php you need, really you didn’t find them? Dump1090 MySQL Database Script with Alert and Filter)

Anyway just use a wider net regarding the coordinates.
Use these settings to catch all airplanes

$user_set_array['max_lat'] = 90.000000;    $user_set_array['min_lat'] = 0.000000;    $user_set_array['max_alt'] = 80000;               
$user_set_array['max_lon'] = 180.000000;    $user_set_array['min_lon'] = -180.000000;

Make sure max is always bigger than min. Otherwise it won’t work.
Good luck.

1 Like

If you need the changes just scroll up and read my conversation with ZMS it should help you.

                isset($row['gs']) ? $ac_speed = $row['gs'] : false;
                isset($row['baro_rate']) ? $ac_vert_rate = $row['baro_rate'] : false;
                isset($row['alt_baro']) ? $ac_altitude = $row['alt_baro'] : false; 

Hmmm tried it, but it won’t work…

After that I tried:

foreach ($json_data_array['aircraft'] as $row) {
		isset($row['hex']) ? $ac_hex = $row['hex'] : $ac_hex = '';
		isset($row['flight']) ? $ac_flight = trim($row['flight']) : $ac_flight = '';
		isset($row['alt_baro']) ? $ac_altitude = $row['alt_baro'] : $ac_altitude = '';
		isset($row['lat']) ? $ac_lat = $row['lat'] : $ac_lat = '';
		isset($row['lon']) ? $ac_lon = $row['lon'] : $ac_lon = '';
		isset($row['track']) ? $ac_track = $row['track'] : $ac_track = '';
		isset($row['speed']) ? $ac_speed = $row['speed'] : $ac_speed = '';
		isset($row['vert_rate']) ? $ac_vert_rate = $row['vert_rate'] : $ac_vert_rate = '';
		isset($row['seen_pos']) ? $ac_seen_pos = $row['seen_pos'] : $ac_seen_pos = '';
		isset($row['seen']) ? $ac_seen = $row['seen'] : $ac_seen = '';
		isset($row['rssi']) ? $ac_rssi = $row['rssi'] : $ac_rssi = '';
		isset($row['messages']) ? $ac_messages = $row['messages'] : $ac_messages = '';
		isset($row['category']) ? $ac_category = $row['category'] : $ac_category = '';
		isset($row['squawk']) ? $ac_squawk = $row['squawk'] : $ac_squawk = '';
		isset($row['nucp']) ? $ac_nucp = $row['nucp'] : $ac_nucp = '';
		isset($row['mlat']) ? $ac_mlat = implode(' ', $row['mlat']) : $ac_mlat = '';
		isset($row['tisb']) ? $ac_tisb = implode(' ', $row['tisb']) : $ac_tisb = '';
		isset($row['gs']) ? $ac_speed = $row['gs'] : false;
        isset($row['baro_rate']) ? $ac_vert_rate = $row['baro_rate'] : false;

Worked when I run an echo $hex; but also no input in the database…

grrrr, can I send you my radar.php so you can check it?

script is running well but no data uploaded to the database…

pi@raspberrypi:~ $ sudo systemctl status radar.service                          ● radar.service - radar.php
   Loaded: loaded (/etc/systemd/system/radar.service; enabled)
   Active: active (running) since Fri 2018-11-16 12:10:18 CET; 4s ago
 Main PID: 5609 (radar.php)
   CGroup: /system.slice/radar.service
           └─5609 /usr/bin/php /home/pi/radar.php

Nov 16 12:10:18 raspberrypi systemd[1]: Started radar.php.

probably you have lat and lon set wrong.
can you paste that section in here?

Also paste some output from the script when you run it.
One screen is enough.

1 Like

I think I’ve a problem. I installed MariaDB so MYSQL is not running anymore. Could it be that?


Are you really asking if the database does not work if it’s not running?

1 Like

Nice program @TomMuc
I have gone up a very steep learning curve to get to the point where “SELECT * FROM aircrafts;” gives me a table with actual data. :slight_smile:
The next questions is based on moving from a small scale environment to collecting on going data in an ever expanding data-set

  1. how do I run the program on the Raspi 3b so it runs at startup, and automatically thereafter.

    Sorry if these are noobie questions,


you can autostart with cron or systemservice. all needed info you’ll find here in the forum in the several threads about the scripts.


Read the first post, the section titled

is what automatically starts the script.

1 Like

So there seems to be no php5 anymore… what should the apt-get be changed to?


Using php instead of php5 should work.


pi@piaware:~ $ sudo apt-get install php-common php-cgi php-mysql php-sqlite php-curl php
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package php-sqlite is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘php-sqlite’ has no installation candidate

sudo apt-get install php-common php-cgi php-mysql php-sqlite3 php-curl php

do it like that :slight_smile:


The php and sql package naming/numbering system makes their installation hard for a non-expert user. :rage: :frowning_face:


They do indeed… thanks for the help


I noticed aircraft type isn’t in the database… can someone help me out in adding it?