Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;

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

1    JOHN    UK
2    DAVE    UK
1    ANITA   USA
2    CAL     USA

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

share|improve this question

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.

What software do you have available? This question is a possible duplicate‌​s-from-attributes/22585#22585 – Alexandre Neto Feb 15 '13 at 12:39
Much more about this FAQ is available by searching our site: – whuber Feb 15 '13 at 16:14
Another post that will help you is here: How can i split by attribute in ArcGIS 10? - a couple of the answers either have Python code or you can open up the script tools that are mentioned to examine the code and modify for your purposes. – ccn Feb 15 '13 at 16:34

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:

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

What's the easiest way to install GDAL and OGR for Python?

And here's the tutorial:

share|improve this answer

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.

share|improve this answer

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