5

This question already has an answer here:

I have a shapefile where there are 3 fields OBJECTID, NAME , LOCALITY. I want to create new shapefile that contains the geometry, projection etc. of the parent shapefile and according to the locality;

OBJECTID    NAME    LOCALITY
1    JOHN    UK
2    ANITA   USA
3    CAL     USA
4    DAVE    UK

This shapefile is read and two seperate shape files are created with the properties
of the parent shape files

OBJECTID    NAME    LOCALITY
1    JOHN    UK
2    DAVE    UK
OBJECTID    NAME    LOCALITY
1    ANITA   USA
2    CAL     USA

Please guide me how to do it. I am new to Python

marked as duplicate by whuber Feb 15 '13 at 16:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

Here's a tutorial showing you how to do exactly what you're looking for. Before you start you'll need to install the gdal/ogr bindings for Python. Information for that can be found here:

http://pypi.python.org/pypi/GDAL/

Here's a question from here on how to install the bindings:

Installing GDAL and OGR for Python?

And here's the tutorial:

http://cosmicproject.org/OGR/cris_example_write.html

0

If you have ArcGIS at your disposal and do not want to write anything from scratch, there is already a tool available for that (if I got you right, you want to "split" the shapefile by a certain attribute).

You could also build a model:

enter image description here

Or check another GIS Stackexchange thread.

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