I am building a script in python using OGR/GDAL.
I have a set of shapefiles and a set of GeoTiff raster files.
I would like to have my script ignore shapefiles if they do not intersect with the raster area.
The shapefile is not a rectangle, so I cannot simply compare the xmin/xmax,ymin/ymax values returned by layer.GetExtent(). I need the actual polygon representing it's overall shape, and then some way of determining if that polygon intersects with the raster square.
I was thinking I could somehow merge all the polygons in the shapefile into one feature, and then read the geometry on that feature, and then compare that information to the raster extent. However, I am unsure of specifically how to execute this.
- How to extract border polygon information from shapefile?
- How to determine if that polygon intersects a given square area?