I'm trying to find an error which occurs when running an FME-script which calls some Python code. In order to recreate the problem I use ArcMap to execute Python code and there I discovered some strange things.
Arcmap version 10.7
First I use toolbox to execute the method: arcpy.MakeRasterLayer_management
I enter all values which in this case is just an input and output raster. The call works well. From the Results section I copy the Python Snippet which gives me the call in Python.
Then I paste this code into the ArcMAP Python Console and when executing i get this error:
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 7519, in MakeRasterLayer raise e ExecuteError: ERROR 000867: Environment: contains invalid cell size or dataset.
The call looks like:
arcpy.MakeRasterLayer_management(in_raster="D:/tmp/anders/Markatkomst_NMD.gdb/NVA_raster", out_rasterlayer="in_memory\NVA_raster2_mem", where_clause="", envelope="281360 6153230 820480 7403330", band_index="")
In short I'm trying to copy a raster from a file gdb to in_memory for later use.
Anyone who has an idea what the problem is? Is this a bug?
My original code in ArcMap which doesn't work either looks this simple:
import arcpy
import os
workSpace = 'D:\\tmp\\anders\\Markatkomst_NMD.gdb'
arcpy.CheckOutExtension("Spatial")
arcpy.env.workspace = workSpace
arcpy.env.extent = "MINOF"
arcpy.env.overwriteOutput = True
raster_name = "NVA_raster"
raster_mem = "in_memory\\" + raster_name
raster = os.path.join(workSpace, raster_name)
print('Make raster layer prio')
print(raster)
arcpy.MakeRasterLayer_management(raster, raster_mem)
Regards
Anders Mark