ADS-B Radar

Settings

Initial setup

URL

The location of the JSON file

The most important setting for ADS-B radar is to provide it with the URL to the JSON file with decoded ADS-B data.

Depending on your setup this file could be in several locations, try to find the correct URL by using Safari. If you can view the JSON file in Safari, the URL is correct. Some examples are:

  • http(s)://receiver-ip/dump1090/data/aircraft.json
  • http(s)://receiver-ip/dump1090-fa/data/aircraft.json
  • http(s)://radarcape/aircraftlist.json

It might be necessary to create a symbolic link (FlightAware) to http(s)://receiver-ip/data/aircraft.json

cd /var/www/html
sudo ln -s /run/dump1090-fa data

If you have multiple receivers, or you have access to receivers elsewhere in the country, you can enter the URLs comma separated. Each entry will be a new station for ADS-B Radar, and data will be processed accordingly.

 

Lat, Lon & Range

The location of your receiver

Provide the latitude and longitude of the receiver so ADS-B Radar knows where to zoom in and where to draw the radar rings. You can enter 50 nautical miles for the initial range of the receiver and adjust once you start receiving ADS-B data.

Another option which will be discussed later, is the polar plot. The polar plot will accurately determine the real range of your receiver and allows you to fit the radar rings exactly around the plot.

 

Refresh Rates

Manage your data

The map refresh rate determines how often ADS-B radar is going to look for new JSON file(s) when you have the map open. Try to adjust the rate to the time it takes to fetch the file(s) - for example external ADS-B stations might need a bit more time. Increase the refresh rate to reduce network load.

The background referesh rate determines how often the data is fetched when the map is closed. This could be a slower rate, which will still allow for accurate flight routes and aircaft count in the menu bar.

 

URL for JSON notifications

Build your own API

It is possible to re-post the alert notifications with aircraft information in JSON to your web server for further processing. For example you might want to receive an email, tweet, auto post to a blog or log interesting data to another database. The example below in PHP shows how to process the JSON post from ADS-B Radar.


<?php
// Get your unique API key from the ADS-B Radar App
// Use this to validate the JSON posts over https
$apiKey = 'example-571CDE61-C17F-4541';
// Note: The PHP 'mail' command needs to be supported by your web server/domain
$to_email = 'your@email.com';
$from_email = 'your@domain.com';
// HTTP Verifications
if (strtoupper($_SERVER['REQUEST_METHOD']) != 'POST') {
  throw new Exception('Only POST requests allowed');
}
$content_type = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : '';
if (stripos($content_type, 'application/json') === false) {
  throw new Exception('Only content-type application/json');
}
// API Key Verification
$headers = apache_request_headers();
$validApiKey = false;
foreach ($headers as $header => $value) {
    if ($value == $apiKey) {
        $validApiKey = true;
        break;
    }
}
if (!$validApiKey) {
    throw new Exception('Invalid API key');
}
// Read the input stream
$body = file_get_contents("php://input");
// Decode the JSON object
$object = json_decode($body, true);
 
// Throw an exception if decoding failed
if (!is_array($object)) {
  throw new Exception('Failed to decode JSON object');
}
// Prepare the email notification
// Each notification has a title, subtitle and body
$subject = $object["title"] . " : " . $object["subtitle"];
$header = 'From: ' . $from_email;
$message = $object["body"] . "\r\n";
$message = $message . '-----------------' . "\r\n";
unset($object["title"],$object["subtitle"],$object["body"]);
// Add all dump1090 info on the aircraft
foreach ($object as $key => $value) {
    $message = $message . $key . ': ' . $value . "\r\n";
}
$message = $message . '-----------------' . "\r\n";
// Send the email
mail($to_email,$subject,$message,$header);
?>