1

My raster has nonsensical values (based on combination of multiple rasters in previous steps), with attributes maintained (again, due to combination of rasters in previous steps), see below for sample attribute table

enter image description here

I want to reclassify the Value column conditional on the 01_SHP_FINALNLCD attribute i.e. specifically, I want to reclassify all pixels with 01_SHP_FINALNLCD= 52 to 1, 01_SHP_FINALNLCD =41 to 2 etc.

I tried the following in R

How can I do this in R or arcpy? Here is the

trial<-raster[raster$01_SHP_FINALNLCD== 52 | raster$01_SHP_FINALNLCD==41]
Error in .local(x, ...) : invalid layer names

Here is the .rds file uploaded on request by @Spacedman.

  • Can you supply a sample raster with these attribute values that we can work with? Save it in .rds format using saveRDS preferably. – Spacedman Feb 26 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.