HOW TO GET ALTERNATING BLUE/RED CIRCLES IN DUMP1090 IN PIAWARE?
Make a new directory orig-html and copy original files of public_html directory into new directory orig-html
In case you want to revert back, you can copy back these original files to public_html.
cd /usr/share/dump1090/
sudo mkdir orig-html
sudo cp /usr/share/dump1090/public_html/*.* /usr/share/dump1090/orig-html/
#check that files have been successfully copied in new directory orig-html:
cd orig-html
dir
#This will be displayed:
config.js gmap.html planeObject.js style.css
extension.js options.js script.js
Now EDIT the file “config.js” in the folder public_html:
cd /usr/share/dump1090/public_html
sudo nano config.js
This will open file config.js for editing in terminal.
File config.js with modifications in red:
// --------------------------------------------------------
//
// This file is to configure the configurable settings.
// Load this file before script.js file at gmap.html.
//
// --------------------------------------------------------
// – Output Settings -------------------------------------
// Show metric values
Metric = false; // true or false
// – Map settings ----------------------------------------
// The Latitude and Longitude in decimal format
CONST_CENTERLAT = 45.0;
CONST_CENTERLON = 9.0;
// The google maps zoom level, 0 - 16, lower is further out
CONST_ZOOMLVL = 10;
// – Marker settings -------------------------------------
// The default marker color
MarkerColor = “rgb(127, 127, 127)”;
SelectedColor = “rgb(225, 225, 225)”;
// – Site Settings ---------------------------------------
SiteShow = true; // true or false
// The Latitude and Longitude in decimal format
//Insert here YOUR Latitude & Longitude
SiteLat = 43.6; //YOUR Latitude
SiteLon = -79.6; //YOUR Longitude
SiteCircles = true; // true or false (Only shown if SiteShow is true)
// In nautical miles or km (depending settings value ‘Metric’)
SiteCirclesDistances = new Array(50,100,150,200,250,300);
After modifications, **save (Ctrl+o) and exit (Ctrl+x)
**
Now modify file script.js in folder public_html
sudo nano script.js
This will open file script.js for editing.
Now press “Ctrl+w” then type “function drawCircle” and press Enter.
The cursor will move to “function drawCircle”
Following code will be displayed. Make changes as shown in red:
function drawCircle(marker, distance) {
**
var circleColor;
if (distance==50||distance==150||distance==250)circleColor=“#0000FF”;
if (distance==100||distance==200||distance==300)circleColor=“#FF0000”;
**
if (typeof distance === ‘undefined’) {
return false;
if (!(!isNaN(parseFloat(distance)) && isFinite(distance)) || distance <$
return false;
}
}
distance *= 1000.0;
if (!Metric) {
distance *= 1.852;
}
// Add circle overlay and bind to marker
var circle = new google.maps.Circle({
map: GoogleMap,
radius: distance, // In meters
fillOpacity: 0.0,
**strokeColor: circleColor,**
strokeWeight: **2**,
strokeOpacity: 0.3
});
circle.bindTo('center', marker, 'position');
}
After modifications, save (Ctrl+o) and exit (Ctrl+x)
now run the web interface and you will see colored circles.