[GRASS-user] Subtraction of raster maps

Otto Dassau otto.dassau at gmx.de
Wed Jun 24 02:56:19 EDT 2009

Hi Thomas,

On Wed, 24 Jun 2009 08:42:11 +0200
"Thomas Becker" <thomasGeo at gmx.de> wrote:

> Hi,
> I know it is pretty standard to subtract to maps from each other and I do have
> the command for r.mapcalc, but it is not doing what I expect.
> I have a landcover map and a map wit buildings. Both are raster maps. Now I
> want to get rid of the areas in the landcover map that are covered by
> buildings. To get this done I wrote:
> r.mapcalc "newmap = landcover - buildings"

if I understand right this might work for you, if everything that is not a
building in your 'buildings' map is no data (null):

r.mapcalc "newmap = if(isnull(buildings),landcover,null())"

> The outcome is a map showing only the buildings and no landcover. It also
> doesn't matter if I change the order in the equation, the result is the same:
> Only buildings are delivered.
> Can you help me out with this?
> Thanks,
>     Thomas


More information about the grass-user mailing list