I have a shapefile with thousands of polygons and a shapefile with 28 polygons that completely overlay the first shapefile. I'm trying to split the first shapefile features into 28 smaller shapefiles based on the location of polygons in the second shapefile. Here's an image of the subject.
Manually, I select one (blue) polygon and then I use the "Select Within" plugin which allows selecting features considering if the centroid of polygons falls into the layer of reference. Then I export the selection into a separate file. I'd like to do this process automatically generating X files for X features of the shapefile of reference.
Is there any way to do something like this?
I guess that something with python is possible, but I'm still not able to write a script.