0

I would like to clip raster where the surface intersect another surface and keep elevations that are below only. I am interpolating a vector into a 2D raster (v.surf.rst) for properties at a given elevation (ex: 120 masl), and i would like to clip the raster when it is above the ground surface using a DEM. A- I could subtract the DEM elevation from the raster elevation, and keep only positive values, this way only pixels which are below the DEM would be kept. Using R.Mapcalc.simple, you cannot select which field to apply the formula.

1

It's not quite clear to me what you're asking. (Maybe an example would help). But you can mask out values of one raster by values from another raster as follows: Suppost you have a DEM raster 'dem' and another raster 'properties'. You want to see the properties only where the DEM elevation is above 120. Then:

g.region -ap rast=properties
r.mapcalc "properties_masked = if(dem >= 120, properties, null())

This sets to null all areas of the properties raster that are below 120 elevation.

  • From my understanding, a Mask 'hides' areas of a raster outside of certain areas from a plan view (top view). whereas what I want to achieve is to mask raster cells that are above a DEM, not really a true mask. I have a property that is interpolated within an elevation slice (ex: 120 masl), and I want to remove or if i understand the above response correctly, render the value the raster as Null values where the raster is above the DEM. Then i would just render the raster visible for values which are not Null. other option would be to contour the elevation 120 and create a mask. – fanfanGis Mar 28 at 23:00
  • It worked. if( 120 <= GTA_DEM_COMB_RASTER@Toronto , TEXTURE_120_AllDomain_RST_50x50@Toronto ,null()) Thank you Micha!! I am not sure how to attach an image to show the result. – fanfanGis Mar 29 at 0:31
  • The term "mask" in GRASS does cause some misunderstanding sometimes. When you create a MASK raster in GRASS, all pixels that have some value in that mask are included in any new processing steps. All null values in the MASK raster are ignored. So the intuitive understand of a mask as "hiding" is inverted in GRASS. Everything outside the mask is hidden. – Micha Mar 29 at 10:26
  • ok I understand. Does that mean that when doing an interpolation using a Vector (points), a Mask can be used to prevent the interpolation in that masked rasters. Is the interpolation actually not done for that point and would act as a Boundary condition or just not shown? I am thinking for example if you want to interpolate air quality in streets, the interpolation just uses the areas within the street and the building facade would be boundary, or does interpolate right as if building did not exist and then the Mask just hides the results? In my example, the masks would be DEM and bedrock. – fanfanGis Mar 29 at 11:11
  • to continue on this discussion, when doing the interpolation, as the Mask option in most interpolating plugin allows to select only rasters, Can you actually type a formula just as in r.mapcalc in the module? – fanfanGis Mar 29 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.