Flagging when point feature(s) covered by tables (made as graphics) using ArcPy?

I've set up data driven pages to create a series of maps, but I'm running into a problem which seems like it would be quite common!

I've made some tables (as graphics) using ArcPy and the technique described an Answer to another Question: Adding Table to Layout View using ArcPy?.

However, with a series of maps, sometimes these graphics will cover my points layer.

Does anybody know how to (at least) flag when a point is hidden by my tables?

The way I would approach this is:

  1. Get the corners of your table graphic in page units (perhaps call them tXmin,tYmin,tXmax,tYmax) - you should be able to get these from your script that adds your table as a graphic either straightaway or with a slight enhancement to it.
  2. Get the locations of any point features that you want to avoid in map units - perhaps use arcpy.da.SearchCursor to do this
  3. Use the technique from another Q&A (Convert point XY to page units XY using arcpy?) to convert these points in map units to page units.
  4. Test each point in page units to see whether it is within the corners of your table graphic rectangle (tXmin,tYmin,tXmax,tYmax)

Watch the video: What are Feature Flags? (October 2021).