SQLite Forum

Finding overlap of boxed coordinates
Login
I have a SQLite table that I would like to now query using python and panda dataframe. The table contains the 4 coordinates of a geographic area using longitude and latitude so effectively each entry represents a box shape. What I would like is to query the table and return one line for every occurrence where box overlaps another box and to miss out any rows where there is a box that has no overlap at all. I am ideally looking to show the number of overlaps a row has and to which original rows all link together to form this overlap. Further down the line I would like to visually represent these on the screen to show the overlap perhaps with a backing image to give context.

An example of the data is below (which is for Mars) which uses aerocentric latitude and an east positive longitude I think it was which goes up to 360 from the central point.

UPPER_LEFT_LONGITUDE 347.15
UPPER_LEFT_LATITUDE -36.545832
UPPER_RIGHT_LONGITUDE 347.69
UPPER_RIGHT_LATITUDE -36.486035
LOWER_LEFT_LONGITUDE 347.81
LOWER_LEFT_LATITUDE -40.795116
LOWER_RIGHT_LONGITUDE 348.38
LOWER_RIGHT_LATITUDE -40.735216

Any help appreciated.