I'm a beginner using Python and I'm having some problem...I wrote a code based on code available in the ArcGIS Help, but it does not work ...I need to run the Topo to Raster several times with different parameters ... so I decided to write a code .. I dont know if the problem is in code because I'm in trouble for running up the Topo to Raster using ArcToolBox ... Anyway, if anyone can give a help, would greatly appreciate it!Below is the script...PS: When I use the tool "Watch", whre is a information ..."NameError: name 'fc' is not defined"...I think the problem is here...PS2: I'm using ArcGIS 9.2 yet...# TopoToRaster_IGC.py
# Description: Interpolar os dados do IGC da Bacia do Cavalheiro
# Interpolate a series of point features onto a rectangular raster using TopoToRaster
# Requirements: Ponto Cotado, Curvas de Nível e Hidrografia...
# Author: ESRI, modificado por Michel Metran da Silva
# Date: February 19, 2011
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
try:
# Output Workspace
out_workspace = "E:/GIS_Mestrado/Bacia_Cavalheiro/Topo_Raster_Testes/Arquivos_Teste/"
# Output Features...
out_raster = out_workspace + "t01_dem"
out_strm_shp = out_workspace + "t01_stream.shp"
out_sink_shp = out_workspace + "t01_sink.shp"
diag_txt = out_workspace + "t01_diag.txt"
out_file_txt = out_workspace + "t01_parameter.txt"
# Input Data...
ptos_cotados = "E:/GIS_Mestrado/Bacia_Cavalheiro/Geodata_Cavalheiro/Geodata_Cavalheiro.mdb/IGC/Ptos_Cotados "
ptos_cotados_atributos = "Elevacao "
ptos_cotados_typeof = "PointElevation "
represas = "E:/GIS_Mestrado/Bacia_Cavalheiro/Geodata_Cavalheiro/Geodata_Cavalheiro.mdb/IGC/Represa "
represas_atributos = "# "
represas_typeof = "Lake "
hidrografia = "E:/GIS_Mestrado/Bacia_Cavalheiro/Geodata_Cavalheiro/Geodata_Cavalheiro.mdb/IGC/Hidrografia "
hidrografia_atributos = "# "
hidrografia_typeof = "Stream "
curvas_nivel = "E:/GIS_Mestrado/Bacia_Cavalheiro/Geodata_Cavalheiro/Geodata_Cavalheiro.mdb/IGC/Curvas_Nivel "
curvas_nivel_atributos = "Elevacao "
curvas_nivel_typeof = "Contour "
limite = "E:/GIS_Mestrado/Bacia_Cavalheiro/Geodata_Cavalheiro/Geodata_Cavalheiro.mdb/Bacia_Cavalheiro/MB_250_Contorno "
limite_atributos = "# "
limite_typeof = "Boundary "
# Check out ArcGIS Spatial Analyst extension license
gp.CheckOutExtension("Spatial")
# Load required toolboxes...
gp.AddToolbox("C:/Arquivos de programas/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
# Process: TopoToRaster
gp.TopoToRaster_sa(ptos_cotados + ptos_cotados_atributos + ptos_cotados_typeof + ";" +
represas + represas_atributos + represas_typeof + ";" +
hidrografia + hidrografia_atributos + hidrografia_typeof + ";" +
curvas_nivel + curvas_nivel_atributos + curvas_nivel_typeof + ";" +
limite + limite_atributos + limite_typeof,
out_raster,
"10", #cellsize
"222035,12296793022 7550213,11435197950 226272,14127189049 7555020,42812331390", #x-min x-max y-min y-max
"20", #grid margin
"", #Smallest z value to be used in interpolation (optional)
"", #Largest z value to be used in interpolation (optional)
"ENFORCE", #Drainage option
"CONTOUR", #Contour data option
"40", #Maximum number of iterations (optional)
"", #Roughness penalty (optional)
"1", #Discretisation error factor (optional)
"0", #Vertical standard error (optional)
"", #Tolerance 1 (optional)
"", #Tolerance 2 (optional)
out_strm_shp, #Output stream polyline features (optional)
out_sink_shp, #Output remaining sink point features (optional)
diag_txt, #Output diagnostic file (optional)
out_file_txt) #Output parameter file (optional)
except:
# If an error occurred while running a tool, then print the messages
print "Error in script"
print gp.GetMessages()