[GRASS-user] Default method of rasterizing in v.to.rast

Nikos Alexandris nik at nikosalexandris.net
Mon Feb 23 06:31:48 PST 2015


RichardCooper wrote:

> I'm trying to determine the default method of rasterization used by 
> v.to
> rast.

> In the v.to.rast manual it states in relation to the  -d option, that 
> 'All
> cells touched by the line will be set, not only those on the render 
> path',
> but I'm not certain which method is being used by default.

> I came across a paper by  Biagi and Negretti
> <http://geomatica.como.polimi.it/workbooks/n2/articoli/lbmn.pdf>   * 
> which
> describes how by default vectors are rasterized in GRASS  5. The 
> latter
> authors refer to the 'center' method as being the standard GRASS 
> command in
> 5.0 (p. 4). Is this used in GRASS 7? From my observation (in the Map
> Display), by default, vector area appear to be rasterized if the 
> center of
> the grid cell falls within the area boundary?

> I haven't checked through the code,

Hints:

grep -nr centroid *  # inside the module's source code directory

Binary file OBJ.x86_64-unknown-linux-gnu/vect2rast.o matches
Binary file OBJ.x86_64-unknown-linux-gnu/do_lines.o matches
Binary file OBJ.x86_64-unknown-linux-gnu/do_areas.o matches
Binary file OBJ.x86_64-unknown-linux-gnu/support.o matches
do_areas.c:42:  if (ISNULL(&cat)) {     /* No centroid or no category 
*/
do_areas.c:94:    int i, centroid, nareas_selected;
do_areas.c:114: centroid = Vect_get_area_centroid(Map, i + 1);
do_areas.c:116: if (centroid <= 0) {
do_areas.c:117:     G_debug(2,_("Area without centroid (OK for 
island)"));
do_areas.c:120:     Vect_read_line(Map, NULL, Cats, centroid);
do_areas.c:127:             G_debug(2, _("Area centroid without 
category"));
do_areas.c:131:         /* field < 1, process all areas with centroid 
*/
v.to.rast.html:41:Labeled areas and/or centroids will produce filled 
raster coverages with edges
v.to.rast.html:49:Points and orphaned centroids will be converted into 
single cells on the
vect2rast.c:219:    /* maximum possible numer of areas: number of 
centroids
vect2rast.c:221:     * number of areas with centroid that are within 
cat constraint

Nikos


> but maybe someone has some knowledge on
> the history of v.to.rast?
>
> Cheers,
> Richard
>
> *http://geomatica.como.polimi.it/workbooks/n2/articoli/lbmn.pdf


More information about the grass-user mailing list