This JavaScript code is a plugin for the ADSB aircraft tracking Virtual Radar Server software. The Javascript files need to be used with the Virtual Radar Server Custom Content plugin.
This repo brings together and updates several scripts (EndOfHead.html
and EndOfBody.html
) written by others as well as adds new scripts (Scale.html
and Fullscreen.html
)
Features: 1) 8 different base layer maps 2) OpenAIP Airspace layer 3) Funtional weather layers 4) Moving Day/Night Terminator 5) Airport information (depending if you region has been added) 6) OpenSea and Open Train layers 7) TFR (Temp Flt. Restrictions) - US only
EndOfHead.html
and EndOfBody.html
These two files work in tandem to insert a icon with pop up at the bottom left of the map and allows the user to select airspace layers, weather layers and UK specific overlays which will be added to the base Leaflet map used in VRS.
Users will need to sign up for API keys for some of the functionalty of this script to work properly. 1) Open Weather 1.0 API key Please note: if you do not enter an API key the Pressure, Temperature and Wind layer will not show in the menu. 2) OpenAIP Key Please note: if you do not enter an API key the Airspace layer will not show on the map. 3) Thunderforest Please note: if you do not enter an API key the Spinal Map will not display if selected. 4) Stadiamaps Please note: if you do not enter an API key the Terrain map will not display.
This script is set up to work with VRS as a baremetal install (installed directly onto the OS, either windows or linux) and also to work with SDR-Enthusiasts docker container for VRS. For those working with a baremetal install of VRS the keys need to be inserted into the script here: (around line 50 ish) (Skip this if using the docker container VRS as these are all part of the compose for the container)
// Add API Keys here
var OPENWXAPIKEY = `##OPENWXAPIKEY##`; // replace ##OPENWXAPIKEY## with your key and KEEP the ` `
var OPENAIPKEY = `##OPENAIPKEY##`; // replace ##OPENAIPKEY## with your key and KEEP the ` `
var THUNDERFORESTKEY = `##THUNDERFORESTKEY##`; // replace ##THUNDERFORESTKEY## with your key and KEEP the ` `
var STADIAKEY = `##STADIAKEY##`; // replace ##STADIAKEY## with your key and KEEP the ` `
The user can set default options from within the script to allow a specific map and your choice of layers to be enabled by default. Just set the map number to which ever one you want, and for the layers change those that you want on start up from a 0 to a 1. These options can be found near the top of the script.
// Configuration
var config =
{
/* Map Config */
defaultMap: 1, // 1: OpenStreetMap, 2: OpenStreetMap Dark, 3: OpenTopoMap, 4: WaterColour, 5: CartoDark, 6: Terrain, 7: Satellite, 8: Spinal Map
layerMenuPosition: `bottomleft`, // Valid positions: `topleft`, `topright`, `bottomleft` or `bottomright`
/* Enable Layers */
airspace: 1,
navAids: 0,
tfrUSA: 0,
seaMarkers: 1,
trainMap: 0,
clouds: 0,
rain: 1,
temps: 0,
wind: 0,
pressure: 0,
dayNight: 1,
civilAirfields: 0,
militaryAirfields: 0,
heliports: 0,
glidingSpots: 0
};
The above options are set to show the OpenStreetMap and show the OpenAIP Airspace layer, the OpenSea layer, the Rainviewer layer and the day/night terminator as default.
Fullscreen.html
Adds a full screen button to the VRS map under the zoom +/- buttons and moves the +/- buttons to the top right of the screen.
Scale.html
Adds a distance scale next to the VRS menu in the top left of the map
Ensure Custom Content Plugin installed (Yellow Arrow). Enable Custom content plugin (Blue box) Put the HTML files in the required folder for the Custom Content plugin as per Custom Content plugin instructions (Red Box) and the entire contents of Put these files in VRS root folder
folder into the root folder referenced by the Custom Content plugin (Green Box) and then set up the files injections as per the bottom 4 lines in the below image (Red Box again):
Defaults to GB airports etc. If you wish to change to airports for your country remove the country code e.g. DE
from the end of the .geojson files in the Put these files in VRS root folder
before placing them in the root folder for your VRS
airportsDE.geojson
--> airports.geojson
Countries added on request - please open an issue to request
I am very grateful for the following resources which have been used in this code:
Screenshot of working example:
Also can be seen working on my VRS page - cornwallvrs.com/VirtualRadar.