Raster calculator script to extract no change pixels from temporal land cover data

99
2
Jump to solution
08-08-2022 08:49 AM
Saisai
by
New Contributor II

Hello all,

I need some help in creating a raster calculator syntax to extract areas of no change between 2 temporal land cover raster. One is for 2020 and the other for 2021, my idea was to set areas of change as null using setNull.

I started by using this 2020.tif == 2021.tif which gave a boolean raster (0 & 1) for areas of change and no change, however I would like the output to reflect the land cover classes that remained the same between both years as against a boolean result.

I tried using setNull(2020.tif, 2021.tif, 2020.tif != 2021.tif) but I keep getting errors on the syntax.

Would be grateful on some help on this syntax.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

Con("2020.tif" == "2021.tif", "2020.tif")  # condition, true, false but in this case if not true it will be nodata

If no Input false raster or constant value is specified, NoData will be assigned to those cells that do not result in true from the expression.


... sort of retired...

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

Con("2020.tif" == "2021.tif", "2020.tif")  # condition, true, false but in this case if not true it will be nodata

If no Input false raster or constant value is specified, NoData will be assigned to those cells that do not result in true from the expression.


... sort of retired...
Saisai
by
New Contributor II

Thanks a lot Dan!

This gave me the result I require.

Regards,

Saisai

0 Kudos