From Mark Eijkens:
No longer display flights who have entered the oceanic like X amount of minutes ago already (say ~30).
This could be done in a few ways...
- simply remove clearance requests for aircraft that have ETAs over the OEPs that are >n minutes old
- define a polygon by an array of lat/lon coordinates, defining "the ocean", and check if the aircraft is within that polygon
- define a boundary line demarcating "the ocean" from "not the ocean yet" 😄 and use a similar method to tell if they've crossed the line yet. This seems programatically tricky and potentially unreliable though. See here for an example.
- variation on the last one: define all the OEPs, each a/c measure distance to all OEPs, find closest, find heading from that fix to aircraft-- if east of that fix, a/c is "in the ocean", and then just check the mileage
Either external libraries like turf.js etc could be the answer if planning to use other features in the future, or just use a simple guy like this from stackoverflow:
pt[lat,long]
function isPointInPoly(poly, pt){
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1] < poly[i][1]))
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
&& (c = !c);
return c;
}
From Mark Eijkens:
This could be done in a few ways...
Either external libraries like turf.js etc could be the answer if planning to use other features in the future, or just use a simple guy like this from stackoverflow: