Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to split a single shapefile into multiple shapefiles by attribute. I found ET Geowizard to do this but it's not free. In arcscripts.esri.com I found a tool named "SplitLayerByAttributes" but it does not work in ArcMap . Do you know of any tools or solution to split by attribute?

share|improve this question
    
What do you mean when you say "Split by Attribute"? Do you want the attribute value used to select features out into a new feature class with all features sharing the same value? Or do you want the attribute value used to name the output feature class while it's geometry is used to clip? A diagram or link to a page would help make this clear so can you edit your Question, please? –  PolyGeo Mar 16 at 19:38
    
The SplitLayerByAttributes tool was updated and can be found here resources.arcgis.com/gallery/file/geoprocessing/… –  Dan Patterson Mar 17 at 1:51
add comment

5 Answers 5

up vote 3 down vote accepted

Here are some more free third-party tools that split by attribute:

share|improve this answer
    
+1 For recommending GME –  Aaron Jan 31 '13 at 16:38
add comment

Did you see Split Layer By Attributes tool updated for ArcMap 10 here? If it does not work you can use Split (Analysis) for your needs.

Splitting the Input Features creates a subset of multiple output feature classes. The Split Field's unique values form the names of the output feature classes. These are saved in the target workspace.

split

Example Code:

import arcpy
arcpy.env.workspace = "c:/data"
arcpy.Split_analysis("Habitat_Analysis.gdb/vegtype", "climate.shp", "Zone",
                     "C:/output/Output.gdb", "1 Meters")

i hope it helps you...

share|improve this answer
    
The built-in Split tool works great for your purposes if you create an extent rectangle the same size as your polygons you wish to split. –  ccn Jan 31 '13 at 16:25
add comment

I do not have access to ArcMap 10, only 9.3, but I expect that it won't be very different from this.

You can create a simple script in Python, that checks your attribute field for different values, and then, for each of them runs a SELECT operation to your original Shapefile.

If you are not familiar with python scripting, all you need to do is open you IDLE (the python GUI) create a new file, and copy the code below. After adapting the code for your my_shapefile, outputdir and my_attribute it should work.

# Script created to separate one shapefile in multiple ones by one specific
# attribute

# Example for a Inputfile called "my_shapefile" and a field called "my_attribute"
import arcgisscripting

# Starts Geoprocessing
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1

#Set Input Output variables
inputFile = u"C:\\GISTemp\\My_Shapefile.shp" #<-- CHANGE
outDir = u"C:\\GISTemp\\" #<-- CHANGE

# Reads My_shapefile for different values in the attribute
rows = gp.searchcursor(inputFile)
row = rows.next()
attribute_types = set([])

while row:
    attribute_types.add(row.my_attribute) #<-- CHANGE my_attribute to the name of your attribute
    row = rows.next()

# Output a Shapefile for each different attribute
for each_attribute in atribute_types:
    outSHP = outDir + each_attribute + u".shp"
    print outSHP
    gp.Select_analysis (inputFile, outSHP, "\"my_attribute\" = '" + each_attribute + "'") #<-- CHANGE my_attribute to the name of your attribute

del rows, row, attribute_types, gp

#END
share|improve this answer
add comment

You can achieve this with a very simple model if you have ArcGIS 10.0 or higher.

Create a model with Feature Iterator where the group by field is the attribute you wish to select by then send the output to the copy features tool using inline substitution to ensure a unique file name. The model is shown below:

Model for extracting by attribute

share|improve this answer
add comment

You can use a Search Cursor to loop through individual features in a feature class and write the geometries to unique feature classes. In this example, I use a feature class of the USA and export the states to new shapefiles:

import arcpy

# This is a path to an ESRI FC of the USA
states = r'C:\Program Files (x86)\ArcGIS\Desktop10.2\TemplateData\TemplateData.gdb\USA\states'
out_path = r'C:\temp'

with arcpy.da.SearchCursor(states, ["STATE_NAME", "SHAPE@"]) as cursor:
    for row in cursor:
        out_name = str(row[0]) # Define the output shapefile name (e.g. "Hawaii")
        arcpy.FeatureClassToFeatureClass_conversion(row[1], out_path, out_name)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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