[GRASS5] strange v.buffer behavior

Markus Neteler neteler at itc.it
Thu Apr 14 08:21:26 EDT 2005


On Wed, Apr 13, 2005 at 05:04:30PM -0700, Michael Barton wrote:
> We are having problems with v.buffer in GRASS 6.0 and 6.1. To document this,
> we tried it on the Spearfish data set. Here is what is happening.
> 
> Use v.buffer on the roads.
> No problem. It behaves as expected.
> 
> Convert raster streams to vector (r.thin, r.to.vect)
> New stream vector displays fine
> Use v.buffer on converted stream vector.
> Vector area created with 0 nodes, 0 lines, 0 areas, etc.
> That is, v.buffer goes through the motions, does NOT generate an error,
> produces the vector folder and creates all the requisite vector files, but
> there is NOTHING in them (the coor file is 0kb and the rest are 4 kb‹i.e.,
> headers only)
> 
> Any idea what is going on?

I have tried: doesn't work

    r.thin streams out=streams2
    r.to.vect streams2 out=streams2 f=line
    v.buffer streams2 out=streams2_buf buf=100

Because (?):
    v.category streams2 op=report
    -> no categories

    v.db.connect -p streams2
    Database connection for map <streams2> is not defined in DB file

I assume that v.buffer only works if categories are present.
This indicates that something is missing in r.to.vect.

Analysing the code lines_io.c of r.to.vect shows that there is no
db_*() support implemented. I darkly remember that this is
missing due to the problem that you cannot easily assign
raster values to a line (if you don't want to make each line
as long as a single pixel).

Oh, RTFM:
 Attributes are ignored for feature=line
 http://grass.itc.it/grass60/manuals/html60_user/r.to.vect.html

So, once we have an algorithm to decide how to assign attributes
to lines within r.to.vect, then v.buffer will work (it should
print an error, though).

For now v.category will help to assign new categories:

 v.category streams2 out=streams3 option=add
 v.buffer streams3 out=streams3_buf buf=100
 d.vect streams3_buf

Voila'!

Markus




More information about the grass-dev mailing list