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 write a script in Python which takes data and does some things with it.

So far, I have written the following code :

import arcpy
arcpy.env.workspace = "C:\wody.gdb"
arcpy.env.overwriteOutput = True
fcList = arcpy.ListFeatureClasses()
bufferList = []
for fc in fcList:
   if fc == "RZEKI":
       arcpy.Buffer_analysis(fc, fc + "Buffer", "200 meters")
       bufferList.append(fc + "Buffer")

Now, I would like to take RIVERS (RZEKI) only if river is longer than SOMETHING (they do not give data in meters but in units, so I just want to see an example seems like river_long > WHATEVER)

Thank you in advance :)

share|improve this question
2  
"I would like to take data and do some things with it" could you possibly be any more vague? :) –  blah238 Jan 25 '13 at 5:10
add comment

1 Answer

This is a pretty basic Select By Attribute query. I would suggest reading up on the documentation.

This is taken right from the example in the online help:

# Within selected features, further select only those cities which have a population > 10,000   
arcpy.SelectLayerByAttribute_management("lyr", "SUBSET_SELECTION", ' "population" > 10000 ')

As far as calculating length, the help article A quick tour of Python will give you the code to calculate the length of the feature in the source units of the layer. Take a look at:

!shape.length!
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.