I'm looking for an equivalent of the conditional expression "Con" from arcpy in an open source spatial analysis package. I'd prefer to use QGIS or R.
To provide some additional detail, I need to evaluate some moderately complicated conditional statements in map algebra, e.g., if the value for one raster is above a certain threshold, use one value, but if the value is below that threshold, use a value based on whether another raster value is above or below another threshold, e.g.:
newraster = Con(raster1 < 4, 0, Con(raster2 > 3, 0.5, 1))
Caveat: I have not been able to confirm that the above code will execute, since the machine I'm currently using does not have any ESRI products installed.
data.frameor some kind ofspobject? At first glance it looks as if straightforward R operations would do the trick if you are using a data frame. It would also help if we had reproducible data and code from you... – SlowLearner Aug 26 '13 at 20:38rasterpackage seems to have abundant functions for comparing and manipulating raster objects - check out theCompare-methodssection of the reference pdf. – SlowLearner Aug 26 '13 at 21:25