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

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
"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

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:

share|improve this answer

Your Answer


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.