I have two vectors, one with points and another with the extent of a zone of interest:
I would like to interpolate a surface within that zone of interest. This is just a small example, with larger zones the computational overheard of interpolating across the whole region might not be acceptable.
According the the manual, v.surf.idw
takes the current mask into account:
If the user has a mask set, then interpolation is only done for those cells that fall within the mask.
Getting down to it, I first rasterise the zone map:
> v.to.rast input=zone output=zone_rst use='cat'
Reading areas...
100%
Writing raster map...
100%
v.to.rast complete.
As a pre-check, I check the rasterised map with Map Display:
I then apply this raster as the current mask and finally create the surface:
> r.mask raster=zone_rst
All subsequent raster operations will be limited to the MASK area. Removing
or renaming raster map named 'MASK' will restore raster operations to
normal.
[Raster MASK present]
> v.surf.idw input=points column='z' output=surface --verbose
16 records selected from table
16 points loaded
Interpolating raster map <surface> (136 rows, 132 columns)...
100%
v.surf.idw complete.
[Raster MASK present]
> r.mask -r
Raster MASK removed
But the resulting surface spans across the entire region:
How can I force this module to use the mask?
Update: I previously filed an answer with what appeared to be a solution; however, I had just displayed the resulting surface with the mask still on, therefore only the surface section within the mask was visible.
I have now tried v.surf.idw
with various different masks, both raster and vector, but they are always ignored. The surfaces produced by v.surf.idw
always encompass the entire region. For instance, the following command sequence produces exactly the same result as above:
> r.mask vector=zone
Reading areas...
100%
Writing raster map...
100%
All subsequent raster operations will be limited to the MASK area. Removing
or renaming raster map named 'MASK' will restore raster operations to
normal.
[Raster MASK present]
> v.surf.idw input=points column='z' output=surface_msk_vec --verbose --overwrite
16 records selected from table
16 points loaded
Interpolating raster map <surface_msk_vec> (132 rows, 186 columns)...
100%
v.surf.idw complete.
[Raster MASK present]
> r.mask -r
Raster MASK removed
r.mask
before I use the module.