Python Forum
Finding overlap of boxed coordinates
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding overlap of boxed coordinates
#1
I have a panda dataframe that I would like to now query. The dataframe contains the 4 coordinates of a geographic area using longotude and latitude so effectively each entry represents a box shape. What I would like is to query the dataframe 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.
Reply
#2
What have you got so far?
Reply
#3
(Aug-31-2021, 04:34 PM)jefsummers Wrote: What have you got so far?

Not a lot. I think I need some comparative maths formula to compare the coordinates but not sure where to start. Was hoping there may be geometric python add in that would pre package the maths.
Reply
#4
Look at shapely
Reply
#5
(Aug-31-2021, 08:25 PM)jefsummers Wrote: Look at shapely

Thanks away to check out geopanda and shapely.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Efficient way to mark entries in df with overlap in time ranges Andreas_Python 0 1,523 Mar-24-2021, 02:10 PM
Last Post: Andreas_Python
  Finding Coordinates Sikum7 0 1,621 Mar-27-2019, 11:25 AM
Last Post: Sikum7

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020