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()
Fezter
  • 21,867
  • 11
  • 68
  • 123
oops
  • 111
  • 3

1 Answers1

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.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338