1

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.

Please see attatched image. ![nlairspace](https://imgur.com/cowoFCn)

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?

JPlanken
  • 55
  • 1
  • 9
  • 2
    Which [DBMS](https://en.wikipedia.org/wiki/DBMS) product are you using? "SQL" is just a query language, not the name of a specific database product. Please add a [tag](https://stackoverflow.com/help/tagging) for the database product you are using `postgresql`, `oracle`, `sql-server`, `db2`, ... –  Apr 11 '19 at 09:27
  • 1
    Some DBMSes have GeoSpatial extensions which should cover your needs – dnoeth Apr 11 '19 at 09:31
  • The database is a HDFS *** OpenSky Network Impala Shell ******************************************************************************** *** [hadoop-29:21000] > SHOW DATABASES > ; +---------+-----------------------+ | name | comment | +---------+-----------------------+ | default | Default Hive database | | opensky | | +---------+-----------------------+ – JPlanken Apr 12 '19 at 10:43

0 Answers0