mykonosman

Work on SHP file in a .ZIP file...instead of a Folder

Discussion created by mykonosman on May 9, 2012
Latest reply on May 9, 2012 by dkwiens
I am trying to run this script on about 100 SHP files I have stored in ZIP files.  Ideally I would like to be able to have the script look inside the ZIP file so I don't have to extract all these ZIPS.

Could I modify this code: fcs = gp.ListWorkspaces("*","Folder") and replace the "Folder" with something else ?


import arcgisscripting
import logging
import os 
logger = logging.getLogger()

# Create the geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True

# Set the workspace. List all of the folders within
gp.Workspace = "C:\MetaData"
fcs = gp.ListWorkspaces("*","Folder")

#
for fc in fcs:
    gp.MakeFeatureLayer(fc + "\\Parcels.shp","lyr")
    gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", "\"STATE\" >=''")
    print "Parcel COUNT FOR " + fc + " IS: " + str(gp.GetCount_management("lyr").getoutput(0))
    gp.SelectLayerByAttribute_management("lyr", "NEW_SELECTION", "\"APN\" >''")

Outcomes