Trying to set output Extent for Topo To Raster in Python

324
2
02-26-2011 06:27 AM
CharlesGant
New Contributor III
Ok, So the code is below.  It works except the way its written it uses the default output extent.  I need to be able to add a shapefile as the output extent, or a variable (which is a shapefile declared at the top of the code).  It seems there are a few different ways to do the topo to raster syntax.  This one works, I just need to add the output extent and I dont know where exactlly?

My variable for my output extent is: MEG_counties_shp__2_

# Process: Topo to Raster
from arcpy.sa import *
import arcpy
outTTR = TopoToRaster([TopoPointElevation([['R:\\PrecipMap\\DailyPrecip.shp', 'pcpn']])], "0.003", "", "20", "", "", "ENFORCE", "CONTOUR", "40", "", "1", "0", "", "")
outTTR.save("R:\\ArcGIS\\Default.gdb\\TopoToR_shp2")
print 'Topo To Raster Done'

I have tried this but it does not work:
outTTR = TopoToRaster([TopoPointElevation([['R:\\PrecipMap\\DailyPrecip.shp', 'pcpn']])], "0.003", MEG_counties_shp__2_,"", "20", "", "", "ENFORCE", "CONTOUR", "40", "", "1", "0", "", "")
outTTR.save("R:\\ArcGIS\\Default.gdb\\TopoToR_shp2")
print 'Topo To Raster Done'
Tags (2)
0 Kudos
2 Replies
CharlesGant
New Contributor III
Anyone have any ideas?
0 Kudos
MathewCoyle
Frequent Contributor
You could try passing the extent from describe, and add those variables in the proper place in the TopoToRaster

dsc = arcpy.describe(<shapefile>)
X1 = dsc.Extent.XMin
Y1 = dsc.Extent.YMin
X2 = dsc.Extent.XMax
Y2 = dsc.Extent.YMax
0 Kudos