Geoprocessing

From Wildsong
Revision as of 23:20, 11 May 2006 by Brian Wilson (talk | contribs)
Jump to navigationJump to search

Model Builder

Online help: http://webhelp.esri.com/arcgisdesktop/9.1/index.cfm

The script so far:

# ---------------------------------------------------------------------------
# StructId.py
# Created on: Tue Feb 14 2006 05:06:58 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, win32com.client

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

# 
gp.workspace = "H:/BrianWilson/Workspace/Collections/Collections.mdb/Collections"
out_workspace = "C:/Temp/NewShapefiles"

# Load required toolboxes...
#gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# Process: Calculate Field...
# the expressions here can only be very simple.
# You can use variables in [square brackets], you can use constants, and you can use
# simple operators like + - / * and (for strings) &
# manhole_shp = "C:\\TEMP\\NewShapefiles\\manhole.shp"
#gp.CalculateField_management(manhole_shp, "STRUCT_ID", "[STRUCT_TYP]&\"-\"& [MH_LABEL]")

# Export all the feature classes from our geodatabase to individual shapefiles
fcs=gp.ListFeatureClasses()
fcs.reset()
fc=fcs.Next()
while fc:
    output_shapefile = out_workspace + '/' + fc
    gp.AddMessage("Working on " + fc + "...")
    gp.FeatureClassToShapefile_conversion(fc, out_workspace)
    fc = fcs.next()

# Rename the new shapefiles to their correct GISMO names

# Calculate the missing field values

# Delete the fields that don't belong in GISMO output