Set extent without using an existing raster with Feature To Raster

548
1
04-06-2011 03:31 PM
GuyDuke
New Contributor
I'm trying to convert feature data to raster and have a defined coordinate extent that I want to use for the output grids.  I don't, however, want to rely on using snap raster with an existing dataset to do this.  This code does the conversion but it ignores the extent setting.

import arcpy
arcpy.env.workspace = "C:\Test\ArcGIS_Python_Course\Roads"
arcpy.env.extent = arcpy.Extent("677000,5527000,710000,5545000")


#set local variables
cellSize = 100
inFeature = "Roads3.shp"
outRaster = "g3"
field = "GRID"

outGrid = arcpy.FeatureToRaster_conversion(inFeature, field, outRaster, cellSize)

print "Finishg processing..."


Does anyone know how to set the grid extent for this tool without using an existing file?

Thanks
Tags (2)
0 Kudos
1 Reply
GuyDuke
New Contributor
OK - I solved this one on my own.  If you set the extent like this it works.

arcpy.env.extent = "677000 5527000 710000 5545000"


This does not work.

#arcpy.env.extent = arcpy.Extent("677000,5527000,710000,5545000")
0 Kudos