I have a very large shapefile (all the roads in RI). I need to split it up into chunks so that I can process the file with multiple worker threads in Python. So far I have created a grid in QGIS that is overlaid on the vector data. I then ran the intersection algorithm with the grid and the shapefile so that the vectors are split up and are assigned an 'id' for the box they're part of.

Now, since all the vectors in a particular box of the grid all have the same 'id', can I extract them and save them to their own shapefile automatically? I am aware of selecting all vectors with an 'id' and then copying them to their own layer and then saving that layer, but I have so many boxes/id's that it would take forever to save each of them off. How can I use QGIS to automatically make a new shapefile for each id/box?

Basically I want create a new shapefile for each distinct value of a particular field in the shapefile attributes.

Original Shapefile

Shapefile after grid intersection

A set of vectors which share the same bbox/id


1 Answer 1


You can split shapefile into multiple shapefiles based on any distinct field value using Vector > Data Management Tools > Split Vector Layer.

Select a field for Unique ID field option and a folder. All shapefiles will be created in that folder.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.