Adding static features to openlayers map in dump1090

Ivan asked a question about adding static features to a map.

Using an example of Holbeach military range in the UK, here’s how it’s done:

In script.js, around line 501, after:


        OLMap.on('click', 'dblclick'], function(evt) {
                var hex = evt.map.forEachFeatureAtPixel(evt.pixel,
                                                        function(feature, layer) {
                                                                return feature.hex;
                                                        },
                                                        null,
                                                        function(layer) {
                                                                return (layer === iconsLayer);
                                                        },
                                                        null);
                if (hex) {
                        selectPlaneByHex(hex, (evt.type === 'dblclick'));
                        evt.stopPropagation();
                }
        });

Insert:


        var dangerAreaStyle = new ol.style.Style({
                fill: new ol.style.Fill({
                      color : 'rgba(255, 0, 0, 0.1)'
                }),
                stroke: new ol.style.Stroke({
                        color: '#FF0000',
                        width: 0.5
                })
        });

        var polyCoords = ];
	var milD207c = 
		[52.806497,0.302124],
		[52.806082,0.202560],
		[52.894820,0.106430],
		[52.932500,0.142822],
		[52.946569,0.166855],
		[52.953189,0.184021],
		[52.960221,0.206680],
		[52.963116,0.230713],
		[52.964357,0.262299],
		[52.960634,0.292511],
		[52.955257,0.312424],
		[52.946569,0.335770],
		[52.935811,0.352249],
		[52.928775,0.361862],
		[52.883634,0.409927]
	];
        for (var i = 0; i in milD207c ; i = i + 1) {
            polyCoords.push(ol.proj.transform([milD207c*[1], milD207c*[0]], 'EPSG:4326', 'EPSG:3857'));
        }
        var d207 = new ol.geom.Polygon([polyCoords]);
        var areaD207 = new ol.Feature({geometry:d207, name:'Danger Area<br>D207'});
        areaD207.setStyle(dangerAreaStyle);
        StaticFeatures.push(areaD207);

	// Add home marker if requested  <-- existing line


to give:
https://dl.dropboxusercontent.com/u/12973352/d207.jpg*

and adding a Military air traffic control zone (aka circle!), in the same area add:


        var matzStyle = new ol.style.Style({
                fill: new ol.style.Fill({
                      color : 'rgba(128, 0, 128, 0.05)'
                }),
                stroke: new ol.style.Stroke({
                        color: '#aa0000',
                        width: 0.5
                })
        });


        var matzCentre = ol.proj.transform([0.4864060, 52.3619330 ], 'EPSG:4326', 'EPSG:3857');
        var matzCircle = new ol.geom.Circle(matzCentre, 15400);
        var afmatz = new ol.Feature({geometry:matzCircle, name: 'EGUN matz'});
        afmatz.setStyle(matzStyle);
        StaticFeatures.push(afmatz);


to show a matz around RAF/USAF Mildenhall UK
https://dl.dropboxusercontent.com/u/12973352/matz.jpg

Cool.
I may do this to add the ADS-B GBT towers in my area. I can add their ICAO prefixes(when I work work them out) so I know where I am getting the information from.

I found a file with the location details
reddit.com/r/stratux/commen … tion_list/

if there are lots, then it maybe worth storing them in a database rather than hand coding each one.
I do that with UK navigation points
https://dl.dropboxusercontent.com/u/12973352/nav.jpg

Can you explain step by step what is needed to do for shows fix waypoints in map? Thanks a lot!

Google maps or OSM?

Please for OSM

sent you a PM

You can also use a static array, since the waypoints are not changing so often, but the database approach is definitely better.
I was going to make some improvements on this code first, but can’t find the time at the moment, so it is not quite finished:



var waypoints = 
   [42.68722,23.56806,"SF600"],
   [42.68167,23.65806,"SF601"],
   [42.67444,23.77056,"SF602"],
   [42.66750,23.88306,"SF603"],
   [42.66167,23.97306,"SF604"],
   [42.57861,23.96306,"SF605"],
   [42.58444,23.87333,"SF606"],
   [42.59139,23.76083,"SF607"],
   [42.59861,23.64861,"SF608"],
   [42.60556,23.53611,"SF609"],
   [42.60972,23.46861,"SF610"]
];

function getStyle(feature) {
	return new ol.style.Style({
		image: new ol.style.Icon({
    		src: 'img/wpt-blue.png'
		}),
		text: new ol.style.Text({
			text: feature.get('name'),
			textAlign: 'left',
			textBaseline: "bottom",
			offsetY: +17,
			fill: new ol.style.Fill({color: '#000'}),
			stroke: new ol.style.Stroke({color: '#fff',width: 2})
		})
    });
}


for (var i = 0; i in waypoints ; i = i + 1) {
   var geom = new ol.geom.Point(
      ol.proj.transform([waypoints*[1], waypoints*[0]], 'EPSG:4326', 'EPSG:3857')
   );
   var wptLabel = waypoints*[2];
   
   var wptList = new ol.Feature({
      geometry: geom,
      name: wptLabel
   });
                                                       
   var style = getStyle(wptList);
   wptList.setStyle(style);
   StaticFeatures.push(wptList);
}

Sample waypoint image: http://i.imgur.com/C8y3Sct.png*
Save it as “wpt-blue.png” and it should go to “/img/”

On the map it looks like this:


@Akissack,
Thank you, once again, for all the great ideas and modifications that you are sharing!*

I would like to add only text (no image) at specific co-ordinates on the map of local point of interest.

How should the code be changed to achieve this?

just drop the image bit:


function getStyle(feature) {
   return new ol.style.Style({
      //image: new ol.style.Icon({
      //    src: 'img/wpt-blue.png'
      //}),
      text: new ol.style.Text({
         text: feature.get('name'),
         textAlign: 'left',
         textBaseline: "bottom",
         offsetY: +17,
         fill: new ol.style.Fill({color: '#000'}),
         stroke: new ol.style.Stroke({color: '#fff',width: 2})
      })
    });
}

@istamov - thanks for the text label code, I hadnt realised I could do that

Thank you!

latest (UK) navpoints
https://dl.dropboxusercontent.com/u/12973352/navpoints.jpg

happy to share the geojson files, just email me at fakissackco.uk

Allan

Sorry to bump an old thread but I’d be really interested in hearing of any techniques to add airspace boundaries (CTRs, CTAs, RW Centrelines etc.) to my FlightAware Dump1090 map. I have .OUT files for most of the UK which I use successfully with the Radar View in FR24, can these be used at all with the Dump1090 map? Or am I destined to add it all manually via the above mentioned file?

NeoDuder,

I am not familiar with the OUT files, do you know what format they are? can you send me an example? I am happy to send my geojson files too (email me at: fakissackco.uk

Allan

.OUT files are a format used by Kinetic for the Basestation software. Also by AirNav for the Radarbox ?

Found a post that details the structure: kinetic.co.uk/forums/viewtopic.php?t=607

Now I need to find some examples.

Here is a sample of a .out file:


{ Bucharest-TMA }
$TYPE=9
45.076111+25.191667
45.076111+26.454167
44.889722+26.966944
44.333333+27.000000
44.000000+25.666667
44.079722+25.253056
44.626944+25.149444
45.076111+25.191667
-1
{ Bucharest-TMA1 }
$TYPE=9
45.022778+26.602222
44.800000+25.966667
44.918056+25.176667
-1


“{ Bucharest-TMA }” is a comment.
“$TYPE=9” - use colour number 9 (defined in SBS or PlanePlotter)
“45.076111+25.191667” = latitude (N), longitude (E)
“-1” = end of section

A VOR definition:


{ ARD lat: 46.184072, lon: 21.143622, magvar: 356.400000 }
$TYPE=15
46.209015+21.141362
46.233957+21.139099
46.233611+21.153210
-1
46.221226+21.150812
46.233611+21.153210
46.231359+21.166952
-1
46.219538+21.161116
46.231359+21.166952
46.227288+21.179795
-1
46.216485+21.170746
46.227288+21.179795
46.221556+21.191245
-1
46.202816+21.167425
46.221556+21.191245
46.214382+21.200860
-1
46.206807+21.186545
46.214382+21.200860
46.206044+21.208273
-1
46.200554+21.192105
46.206044+21.208273
46.196861+21.213198
-1
46.193668+21.195801
46.196861+21.213198
46.187188+21.215447
-1
46.185636+21.179534
46.187188+21.215447
46.177396+21.214936
-1
46.179069+21.197109
46.177396+21.214936
46.167861+21.211685
-1
46.171917+21.194673
46.167861+21.211685
46.158950+21.205821
-1
46.165233+21.190277
46.158950+21.205821
46.151004+21.197570
-1
46.167541+21.170604
46.151004+21.197570
46.144329+21.187249
-1
46.154266+21.176348
46.144329+21.187249
46.139180+21.175256
-1
46.150404+21.167352
46.139180+21.175256
46.135755+21.162049
-1
46.147835+21.157445
46.135755+21.162049
46.134186+21.148137
-1
46.159129+21.145880
46.134186+21.148137
46.134532+21.134051
-1
46.146917+21.136442
46.134532+21.134051
46.136780+21.120332
-1
46.148603+21.126151
46.136780+21.120332
46.140844+21.107506
-1
46.151652+21.116529
46.140844+21.107506
46.146568+21.096064
-1
46.165323+21.119835
46.146568+21.096064
46.153733+21.086447
-1
46.161320+21.100735
46.153733+21.086447
46.162064+21.079023
-1
46.167569+21.095168
46.162064+21.079023
46.171240+21.074078
-1
46.174452+21.091461
46.171240+21.074078
46.180911+21.071805
-1
46.182497+21.107712
46.180911+21.071805
46.190704+21.072291
-1
46.189050+21.090125
46.190704+21.072291
46.200242+21.075519
-1
46.196204+21.092548
46.200242+21.075519
46.209160+21.081366
-1
46.202891+21.096935
46.209160+21.081366
46.217114+21.089609
-1
46.200596+21.116624
46.217114+21.089609
46.223798+21.099932
-1
46.213868+21.110860
46.223798+21.099932
46.228955+21.111937
-1
46.217735+21.119863
46.228955+21.111937
-1
46.220307+21.129780
46.232385+21.125162
46.233957+21.139099
-1