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 usually use ArcGis 9.3.1, but when running a python script that includes Select_by_attribute (from gp), the script runs very very slowly. Is there a way I can perform a select-by-attribute on a opensource-python-module (such as shapely?)? Will it be faster?

share|improve this question

You are likely to see faster results by adding appropriate attribute indexes to your shapefile as outlined at Modifying indexes in shapefiles by indexing an attribute, or moving your data to a FileGDB and adding indexes there.

Any performance benefits of using an opensource option are likely to be outweighed by having to then integrate the results of the query back into your ESRI geoprocessing - unless you want to move the whole process to opensource. Shapely is for manipulating geometry, to select features by attributes you could use OGR and the Shapefile driver.

share|improve this answer

I've not used the python modules, but I've used the ogr2ogr utility for subsetting records from shapefiles by attribrute selection and found it to be orders of magnitude faster than using arcgis geoprocessing (10 seconds versus 6 minutes). Example ogr2ogr selection query:

SELECT * from polylayer WHERE prop_value > 220000.0 ORDER BY prop_value DESC

To keep it in the arcgis world, I've seen gp.Select_analysis be faster than gp.Select_by_attribute. I've not investigated to find out if this is always true or just a momentary peculiarity.

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.