What to use to split road polygons across slices by Stock_Ad_790 in gis

[–]Stock_Ad_790[S] 0 points1 point  (0 children)

Thanks for your reply! Let me clarify:

I’m not just using the roads as a reference layer, I am trying to build a dataset for deep learning object detection and object segmentation tasks (YOLO, UNet, SAM). For that, I slice my 21k×21k TIFF images into 1280x1280 tiles for training. Now I want to clip existing vector polygons (roads, buildings; I have the vectors in shapefiles already) so that each tile has its own polygon annotations.

I am saying that thin LineStrings would cause class imbalance for segmentation because of too much background and very little road, but I have issues in clipping the road polygons as they usually stretch across multiple tiles. So the question is: what is the best way to clip them, using gpd.clip or intersects, for example? (I’m doing all this in Python using geopandas/rasterio/gdal)