I am trying to split a SHP file using all the attributes in the column header SUBURB. Below is an example of the attribute table sitting behind the SHP file:
Name Suburb
ABC BAY
BCV BAY
ABS ISLE
CSD DUNE
QWE ISLE
DSA BAY
AG DUNE
UY WELL
UYA ISLE
I want to be able to specify in the ogr2ogr script that it should split the SHP file based on 'BAY', 'ISLE', 'DUNE'..... without having to specify each one of them manually.
I have tested the -where
tag but unable to get it to split on all the items contained in the header SUBURB. I am new to ogr2ogr so still learning.
Also if this is possible how do I ensure the output SHP files contain the respective SUBURB name?
I am using a windows 8 machine.
The code that I'm using is
ogr2ogr -f "ESRI Shapefile" -where "SUBURB = 'WELL'" D:\Mapdata\Spatial_Data\SHP_Files\Output D:\Mapdata\Spatial_Data\SHP_Files\Input.shp
This code creates the shapefile with features where the SUBURB is 'WELL'. I don't know how to modify this script to get it to create separate shapefiles with respective names for all the SUBURBS.