This is how I define the new values:

I don't think you can do this with a single RasterCellValueReplacer (RCVR).
Either chain as many RCVR as you have classes, making sure the new value isn't in the range of any of the subsequent classes.
Or use a RasterExpressionEvaluator with nested conditionals
if (A 0] >90, 1, if (A 0]>80, 2, if (A 0]>10, 3,0)))
I don't think you can do this with a single RasterCellValueReplacer (RCVR).
Either chain as many RCVR as you have classes, making sure the new value isn't in the range of any of the subsequent classes.
Or use a RasterExpressionEvaluator with nested conditionals
if (A 0] >90, 1, if (A 0]>80, 2, if (A 0]>10, 3,0)))
Thanks! However, this does not work quite yet – I have either the new class 1 or 0 (NoData). It never gets into class 2 or 3 even though it should be getting there according to the source data.
Thanks! However, this does not work quite yet – I have either the new class 1 or 0 (NoData). It never gets into class 2 or 3 even though it should be getting there according to the source data.
Which option are you using?
Which option are you using?
Like this, with RasterExpressionEvaluator

Like this, with RasterExpressionEvaluator

Could you provide your full expresion
Could you provide your full expresion
The following expression matches your original conditionals:
if (A(0]>=@Value(A:Suburban)&&A;0]<@Value(A:Residential),1,if (A(0]>=@Value(A:Urban)&&A;0]<@Value(A:Suburban),2,if (A(0]>=@Value(A:DenseUrban)&& A 0]< @Value(A:Urban),3,if(A(0]<@Value(A:DenseUrban),4,0))))
but if you don't have data above your residential value it can be simplified to
if (Ai0]>=@Value(A:Suburban,1,if (Ai0]>=@Value(A:Urban),2,if (Ai0]>=@Value(A:DenseUrban,3,4)))
The following expression matches your original conditionals:
if (A(0]>=@Value(A:Suburban)&&A;0]<@Value(A:Residential),1,if (A(0]>=@Value(A:Urban)&&A;0]<@Value(A:Suburban),2,if (A(0]>=@Value(A:DenseUrban)&& A 0]< @Value(A:Urban),3,if(A(0]<@Value(A:DenseUrban),4,0))))
but if you don't have data above your residential value it can be simplified to
if (Ai0]>=@Value(A:Suburban,1,if (Ai0]>=@Value(A:Urban),2,if (Ai0]>=@Value(A:DenseUrban,3,4)))
It still does not really work.
I attached a sample raster, do you achieve a classification into 5 classes with RasterExpressionEvaluator?
freiflaeche.tif
It still does not really work.
I attached a sample raster, do you achieve a classification into 5 classes with RasterExpressionEvaluator?
freiflaeche.tif
Put a RasterBandNodataRemover before the RasterExpressionEvaluator.
Bad things happen when there is a NoData value set.
I would use the expression
if (Ai0]==0,0,if (Ai0]>=@Value(A:Suburban,1,if (Ai0]>=@Value(A:Urban),2,if (Ai0]>=@Value(A:DenseUrban,3,4))))
and then you can use a RasterBandNoDataSetter to put back the NoData.
Put a RasterBandNodataRemover before the RasterExpressionEvaluator.
Bad things happen when there is a NoData value set.
I would use the expression
if (Ai0]==0,0,if (Ai0]>=@Value(A:Suburban,1,if (Ai0]>=@Value(A:Urban),2,if (Ai0]>=@Value(A:DenseUrban,3,4))))
and then you can use a RasterBandNoDataSetter to put back the NoData.
great thanks!
this works :-)
just found out about NoData too in this article: https://knowledge.safe.com/articles/1221/elevation-zoning-scenario.html