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?


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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