I am attempting to get the maximum values of two raster datasets and then produce a ratio of the two.
However, when using the GetRasterProperties function, I am only able to print the value to IDLE, but not able to manipulate it as a number.
I get the following error:
As it stands, here is my current code
import arcpyarcpy.env.workspace = "C:\\Path\\GDB.gdb"inraster1 = "raster_1"inraster2 = "raster_2"maxinraster1 = arcpy.GetRasterProperties_management(inraster1, "MAXIMUM","")maxinraster2 = arcpy.GetRasterProperties_management(inraster2, "MAXIMUM","")ratio = maxinraster1/maxinraster2print ratiotext_file = open("test.txt", "w")text_file.write(maxinraster1, maxinraster2, ratio1)text_file.close()
أكثر...
However, when using the GetRasterProperties function, I am only able to print the value to IDLE, but not able to manipulate it as a number.
I get the following error:
TypeError: unsupported operand type(s) for /: 'Result' and 'Result'
So obviously, the value isn't actually called into IDLE as a value I can play with. Reading the help documentation suggests I need to getOutput with the index of the output, but I don't know where I get that index value.
As it stands, here is my current code
import arcpyarcpy.env.workspace = "C:\\Path\\GDB.gdb"inraster1 = "raster_1"inraster2 = "raster_2"maxinraster1 = arcpy.GetRasterProperties_management(inraster1, "MAXIMUM","")maxinraster2 = arcpy.GetRasterProperties_management(inraster2, "MAXIMUM","")ratio = maxinraster1/maxinraster2print ratiotext_file = open("test.txt", "w")text_file.write(maxinraster1, maxinraster2, ratio1)text_file.close()
أكثر...