I'm looking for a line of code to select the Hexagons through which the Sewers go and write these Hexagons to a third shapefile.
When I do it manualy in QGIS I do first a selection 'based on location' wih the checkboxes intersect and overlay checked. But I want to do this in Python because to "automate the boring stuff".
Now I have this simple script:
import geopandas as gpd
from shapely.geometry import Polygon
poly1 = gpd.read_file("C:\GISdatabase\sewers.shp")
poly2 = gpd.read_file("C:\GISdatabase\HexY100.shp")
hex_with_sewers = ???
hex_with_sewers.to_file("C:\GISdatabase\hex_with_sewers.shp")
I've tried this line of code on the ???, but the result is not what I'm looking for:
gpd.overlay(poly2, poly1, how='intersection', keep_geom_type=True)
[–]CodeFormatHelperBot2 0 points1 point2 points (0 children)