[GRASS-user] Subtraction of raster maps

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"

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
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Thomas Becker 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"
  

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

may do the trick, assuming that the buildings map has nodata where there
are no buildings. The newmap would have nodata where there are buildings
otherwise landcover.

Markus M

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
  

Hi Thomas,

On Wed, 24 Jun 2009 08:42:11 +0200
"Thomas Becker" <thomasGeo@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

Regards,
Otto

Hi,

I compiled grass 65 again via svn and suddenly no more vectors are
displayed on mon, but vector work is possible and tables are seen...

Does anyone has the same problem?

Achim
(Im using opensuse11.1 64 bit)

achim:

I compiled grass 65 again via svn and suddenly no more vectors are
displayed on mon, but vector work is possible and tables are seen...
Does anyone has the same problem?

Hi Achim!

I compiled grass65 yesterday. No problem here, everything works fine!

Nikos

achim:

I compiled grass 65 again via svn and suddenly no more vectors are
displayed on mon, but vector work is possible and tables are seen...
Does anyone has the same problem?

Hi Achim!

I compiled grass65 yesterday. No problem here, everything works fine!

Nikos

Hi Nikos,

I do not see anything on grass70. Seems like I should stay with the old
one...without 'within', #touches' ond so on vector-functions :...(

Maybe it comes from experimenting with compiling wx-widgets: I have to
do it in order to run SpatiaLite-gui on my 64-bit linux system (not
successfully yet, but I don't give up..).

Achim

PS: SpatiaLite is a fine and easy SQLite-extension supporting fast
vector relations analysis and manipulation and eg. with the option to
deal with .shp-files via virtual table (without need to build a db
intern table).
Moreover operations can be automated by shell scripting...

> 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.

I also hit these recently.
For the ones not used to everyday-mapcalcs:
the correct command shown by Otto creates a mask.
Simply substracting rasters would lead to a value-by-value substraction...

I hope I interpreted this correctly.