2

I'm trying to do some elementary tasks with ArcPy and ArcGIS, namely separate some information in a file into separate shapefiles based on values for a field.

My initial file has a field called "Source" and "Source" contains combined information for each record about its state and type of feature (rail, road, utlility etc.), given in a string format like "NYRDLINES" (NY, roads) or "MAUTLINES" (Massachussetts, Utilities). I want to create shapefile outputs with just information for, say, roads in NY or utilities in MA.

To do this, I've used "AddField_management" to add 2 new fields to the table: "State, and Feature type", but don't know how to retrieve the information from "Source" to separate into my 2 new fields. I think I should be using "CalculateField_management" to calculate the field values, but am stumped when it comes to defining the expression to be used.

How can I do this?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Mar 16, 2015 at 8:39

1 Answer 1

6

The tool that I would use to "separate some information in a [shape]file into separate shapefiles based on values for a field" is Select_analysis:

Extracts features from an input feature class or input feature layer, typically using a select or Structured Query Language (SQL) expression and stores them in an output feature class.

The same link includes some ArcPy code examples and if you have any problems with syntax for the SQL expression then there are lots of Q&As here that cover most permutations.

answered Mar 16, 2015 at 9:18
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.