Hi All,
I want to use the Raster Calculator to process the raster with 17 different values (Please see the attached file). I want to multiply each raster value (from 1 to 17) by different values. Please let me know your opinions.
Thanks,
Hank
Solved! Go to Solution.
Change all = to ==, and of course, change [raster] to the name of your raster.
An overview of the Map Algebra Operators—Help | ArcGIS for Desktop
Is there some pattern to the values you want to multiply, or somewhat random? If a pattern, you can potentially build a map algebra expression to handle all cases, if random, you may want the Reclassify tool, but it really depends on exactly what you want.
Save us some time and post what you've tried, or at least, provide more information on your specific requirements.
Q Multiplication has a synonym ... what is it?
A Times—Help | ArcGIS for Desktop
and do what Darren says...
Hello Chang,
You might like to use conditional statements in Raster Calculator
e.g. In case of random values
Con([raster1]=1, [raster1]*n1, (Con([raster1]=2, [raster1]*n2, (Con([raster1]=3, [raster1]*n3, (........(Con([raster1]=17, [raster1]*n17)))))))))))))))))
where raster1: name of the input raster
n1...n17: values (You could also write another expression in n1, if required)
Building expressions in Raster Calculator
Hi all,
Thank you for your all responses.
value 2: 0.4615
value 3: 3.2754
value 4: 0.5548
value 5: 2.4472
value 6: 4.9880
value 7: 5.9763
value 8: 4.0460
value 9: 0.1981
value 10: 3.1018
value 11: -1.2635
value 12: 2.5069
value 13: 2.9155
value 14: 0.7207
value 15: 1.4548
value 16: 0.5179
value 17: 1.1133
If I want to use the con in the raster calculator. please let me know if my formula is correct.
assuming the raster of interest is named as raster
con([raster]=2, [raster]*0.4615,
con ([raster]=3, [raster]*3.2754,
con([raster]=4, [raster]*0.5548,
con([raster]=5, [raster]*2.4472,
con ([raster]=6, [raster]*4.9880,
con([raster]=7, [raster]*5.9763,
con([raster]=8, [raster]*4.0460,
con ([raster]=9, [raster]*0.1981,
con([raster]=10, [raster]*3.1018,
con([raster]=11, [raster]*-1.2635,
con ([raster]=12, [raster]*2.5069,
con([raster]=13, [raster]*2.9155,
con([raster]=14, [raster]*0.7207,
con ([raster]=15, [raster]*1.4548,
con([raster]=16, [raster]*0.5179,
con([raster]=17, [raster]*1.1133))))))))))))))))
However, I get the error message, ERROR 000539: Runtime error DyntaxError: keyword can not have an expression
Please let me know how I fix this error.
Thanks,
Changheng
Try this!
con([raster]==2, [raster]*0.4615, (con([raster]==3, [raster]*3.2754, (con([raster]==4, [raster]*0.5548, (con([raster]==5, [raster]*2.4472, (con([raster]==6, [raster]*4.9880, (con([raster]==7, [raster]*5.9763, (con([raster]==8, [raster]*4.0460, (con([raster]==9, [raster]*0.1981, (con([raster]==10, [raster]*3.1018, (con([raster]==11, [raster]*(-1.2635), (con([raster]==12, [raster]*2.5069, (con([raster]==13, [raster]*2.9155, (con([raster]==14, [raster]*0.7207, (con([raster]==15, [raster]*1.4548, (con([raster]==16, [raster]*0.5179, (con([raster]==17, [raster]*1.1133))))))))))))))))
Change all = to ==, and of course, change [raster] to the name of your raster.
An overview of the Map Algebra Operators—Help | ArcGIS for Desktop
Thanks Darren,
Changed the script above accordingly. Missed it earlier
Two tricks
1. no []
2. use ==
Thank you all the efforts.
Changheng
Con("GeoUnits_class.tif"==2, "GeoUnits_class.tif"*0.4615,
Con ("GeoUnits_class.tif"==3, "GeoUnits_class.tif"*3.2754,
Con("GeoUnits_class.tif"==4, "GeoUnits_class.tif"*0.5548,
Con("GeoUnits_class.tif"==5, "GeoUnits_class.tif"*2.4472,
Con ("GeoUnits_class.tif"==6, "GeoUnits_class.tif"*4.9880,
Con("GeoUnits_class.tif"==7, "GeoUnits_class.tif"*5.9763,
Con("GeoUnits_class.tif"==8, "GeoUnits_class.tif"*4.0460,
Con ("GeoUnits_class.tif"==9, "GeoUnits_class.tif"*0.1981,
Con("GeoUnits_class.tif"==10, "GeoUnits_class.tif"*3.1018,
Con("GeoUnits_class.tif"==11, "GeoUnits_class.tif"*-1.2635,
Con ("GeoUnits_class.tif"==12, "GeoUnits_class.tif"*2.5069,
Con("GeoUnits_class.tif"==13, "GeoUnits_class.tif"*2.9155,
Con("GeoUnits_class.tif"==14, "GeoUnits_class.tif"*0.7207,
Con ("GeoUnits_class.tif"==15, "GeoUnits_class.tif"*1.4548,
Con("GeoUnits_class.tif"==16, "GeoUnits_class.tif"*0.5179,
Con("GeoUnits_class.tif"==17, "GeoUnits_class.tif"*1.1133))))))))))))))))