[R-sig-Geo] layer to change nodata values

Hari Sharma himalayanhari at gmail.com
Mon Aug 14 20:07:42 CEST 2017


Hi all,
> I downloaded global water surface layer from Pekel et al., 2016. The data (band values) has 0 to 255. 0 = 0 water, 1 = 1%, 2= 2%….100=100% water and after then 255 (which is no data according to paper). I want to keep this values from 0 to 100 only in the raster and want to change values 255 into nodata. How can I make r code? I have following code but I am not sure it is good not?

a <- raster(“waterlayer.tif)
max <- 100
a[a >= max] <- NA

Hari Sharma
Taiwan




	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list