Creating MASK from vect

Malcolm Williamson malcolm at
Mon May 4 12:17:55 EDT 1998

Hi, Stephan
What you must do is create a vector polygon, from which you can create a 
raster mask. The way that I would do this is first to create a vector 
polygon for your region:

r.mapcalc 'region_poly=1'
r.poly i=region_poly o=region_poly region_poly

Next, patch this polygon to your shoreline, and create nodes where the 
lines cross:

v.patch i=region_poly,(your shoreline layer) o=newmap newmap
v.spag newmap newmap

Finally, use v.digit to edit newmap. You must make sure that the lines 
surrounding the area that you want to show through your mask are "typed" 
as Area (under Edit there is a "re-Type" command), and you must label the 
area with a non-zero value, such as 1. newmap (one more time!) i=newmap o=ocean_mask

Use r.mask to incorporate "ocean_mask" as your mask when desired. 
Remember, the non-zero categories in a raster mask are the areas where 
analysis will occur. I know this all sounds complicated, but it's really 
fairly simple once you understand how it all works. Good luck,
Malcolm D. Williamson - GIS Specialist         E-mail: malcolm at
Center for Advanced Spatial Technologies        Phone: (501) 575-6159
Ozark Rm. 12                                      Fax: (501) 575-5218 
University of Arkansas              
Fayetteville, AR 72701                            Web:

On Sun, 3 May 1998, Stephan Eickschen wrote:

> Hi GRASSers,
> I would like to create a MASK using a shoreline which I have as a
> vector file (ascii or binary) imported to GRASS. Using
> results is a raster layer where everything is 0 but the shoreline,
> so either everything but the shoreline would be visible or the
> other way round :-( What I would like to have is: a mask, which
> blanks the sea. Since it is not an island, or a lake, it is not a
> closed line, the coastline "enters" at the left (western) end of
> my loacation and "leaves" at the right (easter) end. A simple
> "is-north-of-decision" will fail.
> How can I define an area (comparable like a floodfill - pattern in
> image-processing tools), so that I can build up my mask?
> Or is there a way to make it more directly from the vectors?
> Thanks in advance for any suggestion!
> Regards,
>         Stephan
> -- 
> ------------------------------------------------------------------------
> Stephan Eickschen                     Tel. : +49 (0)251 83-34704
> Westfaelische Wilhelms-Universitaet   Fax. : +49 (0)251 83-36100
> Institute for Geophysics
> Research Unit of Physical Glaciology  email: eicksch at
> Corrensstrasse 24
> 48149 Muenster
> Germany
> ------------------------------------------------------------------------

More information about the grass-user mailing list