FlightAware Discussions

Easy way to draw a polygone on the map


#1

It would be great if there was a way to draw a polygone on dump1090-fa’s map (coordinates as GPS coordinates for example). Or is this already possible with a bit of hacking?


#2

I hacked my polygone into /usr/share/dump1090-fa/html/layers.js

After line 19, that means after:
world.push(new ol.layer.Tile({
source: new ol.source.OSM(),
name: ‘osm’,
title: ‘OpenStreetMap’,
type: ‘base’,
}));

I inserted:
//-- hm start ----------------
var traFeature = new ol.Feature({
geometry: new ol.geom.Polygon([[
[6.60888888888889,49.9344444],
[6.89888888888889,49.9427778],
[8.39416666666667,49.7108333],
[8.44888888888889,49.6697222],
[8.37416666666667,49.0763889],
[8.34833333333333,49.0044444],
[8.29166666666667,48.9677778],
[7.51583333333333,49.105],
[6.70194444444444,49.2183333],
[6.42527777777778,49.6297222],
[6.50277777777778,49.8091667]
]])
});
traFeature.getGeometry().transform(‘EPSG:4326’,‘EPSG:3857’);

var traSource= new ol.source.Vector({
features: [traFeature]
});

world.push(new ol.layer.Vector({
source: traSource,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: ‘blue’,
width: 0.5
}),
fill: new ol.style.Fill({
color: [0,0,255,0.05]
})
})
}));
//-- hm end ------------------

That displays a layer of the TRA LAUTER, a German military training airspace. Just change the coordinates in the polygon and you can add your own polygon of interest.