Original User: luke.kaimThis is part of the code that I have. I basically want to create a raster from a feature with the same extents as another raster. It makes the raster, but does not change the extents to the other raster. Can you look at the code to see what I am missing? Also does raster calculator not work in python?
import arcpy, sys, os, re
from arcpy import env
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\\Users\\Luke Kaim\\Documents\\university_of_maine\\research4\\test2"
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
#Raster
IDW20meter2 = "IDW20meter2"
#feature
APPROACH_POLYGON_Project_shp = "APPROACH_POLYGON_Project.shp"
#layer
PolygonFeature = "PolygonFeature"
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(APPROACH_POLYGON_Project_shp, PolygonFeature, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;OBJL OBJL VISIBLE NONE;CONDTN CONDTN VISIBLE NONE;OBJNAM OBJNAM VISIBLE NONE;INFORM INFORM VISIBLE NONE;SCAMIN SCAMIN VISIBLE NONE;SORDAT SORDAT VISIBLE NONE;SORIND SORIND VISIBLE NONE;DSNM DSNM VISIBLE NONE;ArbNumber ArbNumber VISIBLE NONE")
# get the extents of the raster
Bottom = arcpy.GetRasterProperties_management(IDW20meter2,"BOTTOM")
Top = arcpy.GetRasterProperties_management(IDW20meter2,"TOP")
Left = arcpy.GetRasterProperties_management(IDW20meter2,"LEFT")
Right = arcpy.GetRasterProperties_management(IDW20meter2,"RIGHT")
#User specified XMin, YMin, XMax, YMax values.
# set env to those extents I think
arcpy.env.extent = arcpy.Extent(Left, Bottom, Right, Top)
Ftoraster3 = "Ftoraster3"
FinRast_r = "finRast"
FinishedRasterACSII_TXT = "FinishedRasterACSII_TXT.TXT"
print "test"
# Process: Feature to Raster
arcpy.FeatureToRaster_conversion(PolygonFeature, "FID", Ftoraster3, "20")
print "finished"
# Process: Raster Calculator
arcpy.gp.RasterCalculator_sa("Con(IsNull(\"Ftoraster3\"),\"idw20meter2\", -1)", FinRast_r)
# Process: Raster to ASCII
arcpy.RasterToASCII_conversion(FinRast_r, FinishedRasterACSII_TXT)
Any ideas?