You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tar1090 has a nice database with airports ICAO and IATA - just hidden in the search function.
I wanted to see the airports shown as labels on the map.
This helps a lot when using pure satellite maps - but even when using the OSM map with all the info the airports icons are just to small and the ICAO and IATA codes are not visible.
My crude way to implement was
The database used in the search function is located here /usr/local/share/tar1090/git-db/airport-coords.json
This will combine airports which have two database entries from ICAO and IATA like Düsseldorf with EDDL and DUS.
The result is now one entry with "EDDL/DUS". Without this, both labels will be shown unreadable mixed one onto the other.
The script creates the file /usr/local/share/tar1090/html/geojson/airports.geojson
We need to add this as a new layer and add the option to display it
Edit /usr/local/share/tar1090/html/layers_*.js
Added this code just above the line
... return layers_group;
// Show all Airports on the map from converted database
world.push(createGeoJsonLayer('World Airports', 'airports', 'geojson/airports.geojson', 'rgba(52, 50, 168, 0.3)', 'rgba(52, 50, 168, 1)', true, 8, 5));
search for let createGeoJsonLayer
Change the geojson layer creation code to check in the new parameter of minZoom
replace let createGeoJsonLayer = function (title, name, url, fill, stroke, showLabel = true) {
with let createGeoJsonLayer = function (title, name, url, fill, stroke, showLabel = true, Zoom1 = 0, Zoom2 = 20) {
Change the code to check for MinZoom Level and existence of the slash between ICAO and IATA code and display the label depending on the zoom level:
tar1090 has a nice database with airports ICAO and IATA - just hidden in the search function.
I wanted to see the airports shown as labels on the map.
This helps a lot when using pure satellite maps - but even when using the OSM map with all the info the airports icons are just to small and the ICAO and IATA codes are not visible.
My crude way to implement was
The database used in the search function is located here /usr/local/share/tar1090/git-db/airport-coords.json
This needs to be converted to geojson.
Create a bash script
/usr/local/share/tar1090/convert_airports_combined.sh
This will combine airports which have two database entries from ICAO and IATA like Düsseldorf with EDDL and DUS.
The result is now one entry with "EDDL/DUS". Without this, both labels will be shown unreadable mixed one onto the other.
The script creates the file /usr/local/share/tar1090/html/geojson/airports.geojson
We need to add this as a new layer and add the option to display it
Edit /usr/local/share/tar1090/html/layers_*.js
Added this code just above the line
...
return layers_group;
search for let createGeoJsonLayer
Change the geojson layer creation code to check in the new parameter of minZoom
replace
let createGeoJsonLayer = function (title, name, url, fill, stroke, showLabel = true) {
with
let createGeoJsonLayer = function (title, name, url, fill, stroke, showLabel = true, Zoom1 = 0, Zoom2 = 20) {
Change the code to check for MinZoom Level and existence of the slash between ICAO and IATA code and display the label depending on the zoom level:
replace
text: showLabel ? feature.get("name") : "",
with
text: showLabel && OLMap.getView().getZoom() >= Zoom1 ? feature.get("name") : showLabel && OLMap.getView().getZoom() >= Zoom2 && feature.get("name").includes("/") ? feature.get("name").split("/")[1] : "",
Yes - i should have used a variables instead for calling functions more than once and spread this expression in if then else statements.
Zoom1 and Zoom2 are a new parameters - so this does not harm the other geojson layers already in use.
Reload the browser with ctrl-F5 to reload, click on the layers button, select a satellite map,
Enable the new "World Airports" checkmark
and you can see this
I am not sure where/how to put this into the tar1090 project - maybe add this in the update script of the database repo tar1090-db
To not overflow the map with the labels:
The text was updated successfully, but these errors were encountered: