[GRASS-user] r.to.vect stats

Moritz Lennert mlennert at club.worldonline.be
Mon May 1 08:43:31 PDT 2017


On 01/05/17 15:36, Vaclav Petras wrote:
>
> On Mon, May 1, 2017 at 6:54 AM, Moritz Lennert
> <mlennert at club.worldonline.be <mailto:mlennert at club.worldonline.be>> wrote:
>
>     On 01/05/17 12:43, Martin Landa wrote:
>
>         I need a tool which converts vector features (points) to raster map
>         using statistical method like min,max,mean (something like
>         `r.in.lidar` does - if more points are found within one cell, raster
>         value is computed by given method).
>
>         I started with module `r.to.vect`, but it takes only one attribute
>         value if more features found, `v.kernel` does not support
>         attributes.
>         There is probably such tool, I must overlook something...
>
>
>     I generally use v.to.db op=coor && v.db.select | r.in.xyz
>     <http://r.in.xyz> for such a task. I don't know if a dedicated
>     module would be much faster than a script that wraps around these
>     modules. I guess avoiding the v.to.db part could gain you some time
>     when dealing with lots of points.
>
>
> Hi, this is certainly a missing feature. Even the v.to.rast
> documentation [1] says:
>
> v.out.ascii input=myschools_wake output=- column=value | r.in.xyz
> <http://r.in.xyz> input=-

Duh, that's obviously much better than using v.to.db + v.db.select. I 
guess I haven't had many situations lately where the coordinates weren't 
already in the attribute table...

>
> For certain cases, you may be able to use v.out.lidar instead of
> v.out.ascii, but it is probably less efficient (although it uses LAS
> instead of ASCII, you can't use pipes). You could also use v.mkgrid with
> rectangular grid and v.vect.stats [2] followed by v.to.rast (which
> avoids export, but for large grids it is likely very slow).
>
> I have separated the binning code in r.in.lidar [3] so that it can be
> used in r.in.xyz <http://r.in.xyz>

Is it different from the binning code in r.in.xyz ?

> and the missing module which would do
> the binning of a vector map into a raster map. There is actually a large
> overlap with code for grid-based decimation of a point cloud (2D with
> gridded or averaged X and Y). I already committed the code to r.in.lidar
> [4], but we had a discussion on mailing list and decided that this
> functionality should not be part of r.in.lidar, so it is disabled [5]
> but the code is still there.

So what you are saying is that the code should go into a library and be 
used by all relevant modules ?

>
> Anyway, a new module needs to be implemented for this. The name can be
> something like r.binning, r.vect.stats, r.point.stats, or
> r.points.stats. It might good project for beginners.

I like the idea. But do you really think this would be much faster than 
v.out.ascii | r.in.xyz ?

Moritz


More information about the grass-user mailing list