I'm working with a flight-trajectory dataset. Containing a lot of longitude and latitude points. I only want to extract, from a large database, the points that are relevant to my analysis, e.g. points withing the Netherlands airspace.
In order to define a boundary like the orange lines one would write the following code:
SELECT ROUND(lat, 6) AS lat,
ROUND(lon, 6) AS long,
FROM state_vectors_data4 sv
WHERE lat BETWEEN 50.1 AND 54.1 AND
lon BETWEEN 2.2 AND 8.2;
Thereby defining the four points in the corners and extracting all the data withing this square. Is there a methodology of capturing all the points within a polygon? Say within the area draw between the red lines? Or even better is there a methodology of capturing all the points within a 'border interval', say the area between the red and the blue lines?