Sometimes, you need to split a shapefile in order to break a larger dataset into more manageable sizes or to isolate a specific area of interest. There is a script in the Processing Toolbox that splits a shapefile by attribute. It is very useful, even though it is provided as an example of how to write processing scripts.
We will split a census tract shapefile by county. You can download the sample zipped shapefile from https://geospatialpython.googlecode.com/files/GIS_CensusTract.zip.
Extract the zipped shapefile to a directory named
/qgis_data/census
.You also need the following script for the Processing Toolbox:
https://geospatialpython.googlecode.com/svn/Split_vector_layer_by_attribute.py
Next, use the following steps to add the script to the Processing Toolbox:
Download the script to your
/qgis_data/
directory.In the QGIS Processing Toolbox, open the Scripts tree menu and then go to the Tools submenu.
Then, double-click on the Add script from file command...