Opened 6 years ago

Last modified 6 years ago

#3598 new enhancement

v.rast.stats: limit region extent to that of vector

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Vector Version: unspecified
Keywords: v.rast.stats region Cc:
CPU: Unspecified Platform: Unspecified

Description

Currently, v.rast.stats follows general GRASS GIS procedure and respects the current computational region. This means that it rasterizes the vector map and creates a raster map of the size of that region. If the vector map only covers a very small portion of the current region, this means a lot of wasted computing resources and time.

v.rast.stats already slightly changes the current region by aligning it to the raster. By also limiting the extent to the vector (see attached patch), computational time can potentially be significantly reduced.

Two questions before I apply:

  • As the expected behavior of v.rast.stats is to get stats for the features in the vector map, limiting the region extent to that of the vector does not change anything in the results and rather is in line with expected behavior. Any objection ?
  • Is there a risk that by using the vector extent, but aligning to the raster, we lose some edge parts of the vector features ? Or does aligning always extend the region to beyond the request extent ?

Attachments (1)

v_rast_stats_vectorregion.diff (524 bytes ) - added by mlennert 6 years ago.

Download all attachments as: .zip

Change History (6)

by mlennert, 6 years ago

comment:1 by SBL, 6 years ago

See also: https://trac.osgeo.org/grass/ticket/3523#comment:4

Personally, I would prefer if v.rast.stats would not change the computational region at all (like majority of the other modules).

in reply to:  1 comment:2 by mlennert, 6 years ago

Replying to SBL:

See also: https://trac.osgeo.org/grass/ticket/3523#comment:4

Personally, I would prefer if v.rast.stats would not change the computational region at all (like majority of the other modules).

So that means you prefer option 1 in ticket:3523#comment:4. But you also provide option 3 which uses the vector extent.

If we just tell people in the man page that they have to take that responsibility, this kind of defeats the purpose of your proposals in #3523 in the case they would like to calculate statistics on a series of rasters which are not aligned with each other.

I also have not made experiments to see how much of a difference the change of alignment actually makes.

Intuitively, I would go for your option 3.

in reply to:  description comment:3 by mmetz, 6 years ago

Replying to mlennert:

  • Is there a risk that by using the vector extent, but aligning to the raster, we lose some edge parts of the vector features ? Or does aligning always extend the region to beyond the request extent ?

No, aligning to raster map either leaves the extents untouched, or grows the region.

v.rast.stats could use a temporary region to get statistics. In this particular case I think it is ok if the current region is not used.

comment:4 by martinl, 6 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:5 by martinl, 6 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.