I want to write a conditional statement and save it as a .tif file. I have looked through the documentation from ArcGIS and as far as I can tell, my code should work, but I keep getting an error that the computer can't save what I want as a raster. I have saved .tif files earlier in my code, so I'm not sure what the problem is. I've tried to save in different file formats as well, but I got the same error message.
import arcpy
from arcpy import env
arcpy.CheckOutExtension("Spatial")
from arcpy.sa import *
path = 'folderlocation'
env.workspace = path #this is the work environment
template = 'actualrd.tif'
env.extent = template #set the extent
env.cellSize = template #set the cell size
env.overwriteOutput = True #set overwrite output to true
tempEuc = 'temp_dist.tif'
outEucDist = EucDistance(actualrd, 500)
outEucDist.save(tempEuc)
tempCon = r'temp_con.tif'
outCon = Con(((tempEuc >=0) & ('actualrd' == 1)), 1)
outCon.save(tempCon)
I can save the euclidean distance raster file, but not the conditional statement raster file.
RuntimeError: ERROR 010240: Could not save raster dataset to [file location] with output format TIFF.
I am using ArcGIS 10.4.1
'actualrd' == 1
statement doesn't make sense. You are comparing a string to an integer. Shouldn't this beRaster('actualrd') == 1
?