1

I'm trying to write python scripts to batch convert thousands of coverages to shapefiles in arcgis 9.3. The coverages files are in different folders:

d:/area_A/building
d:/area_B/building
d:/area_C/building
...

and the output file will be merged or unioned into a single shapefile:

d:/output/building_merged.shp

I'm stuck in iterating all the input folders..here is what I've got so far:

import arcgisscripting
gp = arcgisscripting.create()

try:    
    gp.Workspace = "d:/area_A/building"   
    gp.FeatureClassToShapefile("polygon","d:/output")  
except:     
    print gp.GetMessages()
2

You say "I'm stuck in iterating all the input folders" so that is the Question this Answer addresses.

Iterating through ArcGIS workspaces becomes much easier at ArcGIS 10.1 SP1 using arcpy.da.Walk.

However, it could be done using earlier versions of arcpy and arcgisscripting using os.walk as described here or glob and other techniques as described here.

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.