[GRASS-user] r.mapcalc changes color table

Dan D'Alimonte dan at dalimonte.ca
Thu Nov 26 18:36:48 EST 2009


Tim Michelsen wrote:
> Dear Grass Users,
> I have a large georeferenced digital map.
> 
> I successfully imported it into GRASS.
> 
> Now I would like to "cut" only a small rectangle -- my investigation
> area -- out of this large map.
> 
> I used the following approach:
> 
> 1) import the TIFF
> 2) select the part of interest in the GRASS monitor
> 3) set the zoomed area as region (monitor tools)
> 4) create a boundary vector: v.in.region
> 5) convert boundary raster to a raster v.to.rast
> 6) use r.mapcalc to cut: r.mapcalc "cut=if(boundary_raster, large_map,
> null())"
> 
> This works well for the cutting. But the color table of the large input
> map is lost resulting in a strange coloring.
> Opened in QGIS, it shows me that there is a "color map" associated with
> the layer.
> How do I get the same color table in the r.mapcalc result?
> 
> Thanks in advance,
> Timmie

You can use r.colors' raster option to copy the colour rules over from 
your original layer.

r.colors map=cut raster=large_map

-- Dan.


More information about the grass-user mailing list