[GRASS-user] Comparing 2 large Corine Land Cover maps

Glynn Clements glynn at gclements.plus.com
Sun Jul 24 11:11:21 EDT 2011


Hermann Peifer wrote:

> I have 2 Corine Land Cover (CLC) raster maps, from 2000 and 2006. Both 
> maps have the same extent, the same resolution (100m) and use the same 
> 44 CLC categories. The maps are pretty large: 67 000 cols x 58 000 rows 
> = 3 886 000 000 cells.
> 
> I'd like to categorise the changes between the 2 layers, according to a 
> decision matrix which I pasted below [1]. Row headers indicate the 
> clc2000 category, column headers represent the clc2006 category. I only 
> pasted the "left half" of the table in order to avoid ugly line breaks.
> 
> 
> Question:
> Is there a better (and faster) way than doing this comparison by using 
> r.mapcalc with a (nearly) endless if/else chain [2] ?

As Paulo suggests, r.cross and r.reclass. Alternatively, the r.cross
step could be done with r.mapcalc as e.g.:

	r.mapcalc 'result = map1 * 100 + map2'

> I also noted that in 99+ % of the cases, both maps are NULL or have an 
> identical CLC category, so I wouldn't need the if/else chain at all. I 
> guess I can use this fact to shortcut the comparison?

r.mapcalc doesn't do short-circuit evaluation, which is why long
"if-else" chains are slow.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list