[GRASS-user] Need Help with speeding up v.import and reducing/removing null values from v.rast.stat results

Stefan Blumentrath Stefan.Blumentrath at nina.no
Fri Mar 23 06:15:45 PDT 2018


Hei Mehrdad,

If your buffers are overlapping, topology will become an issue, as Moritz pointed out.
Johannes Radinger once wrote a workaround for a specific use case that might be of help. See [1]. No idea if it would be possible to come up with something more generic for v.rast.stats…

In v.rast.stas NAs occur most likely due to vector areas that are not rasterized, which usually happens when polygons are relatively small / narrow compared to resolution of the raster map.

However, during community sprint these days in Bonn, Martin Landa added centroids to the rasterization algorithm (v.to.rast) that v.rast.stats uses, than can help to reduce the number of NAs.

Also during community sprint, I created a patch for v.rast.stats [2] that aims at improving the performance of the module by allowing multiple raster input (it needs testing).

There are possible further improvements, but these require some more discussion with the other devs regarding implementation. 

Cheers
Stefan

1: https://lists.osgeo.org/pipermail/grass-user/2017-June/076670.html
2: https://trac.osgeo.org/grass/ticket/3523

-----Original Message-----
From: grass-user <grass-user-bounces at lists.osgeo.org> On Behalf Of Moritz Lennert
Sent: fredag 23. mars 2018 10.52
To: Mehrdad Varedi <varedi at waterlix.com>; grass-user at lists.osgeo.org
Subject: Re: [GRASS-user] Need Help with speeding up v.import and reducing/removing null values from v.rast.stat results

On 22/03/18 22:40, Mehrdad Varedi wrote:
> Hi Everyone,
> 
> I am trying to import few layers with nearly 700,000 buffer areas 
> around the same number of points. Fr each layer t takes more than 4-5 
> hours and most of the time, it just stops in the middle of the process.
> Any idea that which kind of layers can be imported with a faster speed? 
> I need o load 4-5 of such layers and it is now 5 days that I am busy 
> with building a buffer or importing the results.
> 
> Actually I tried v.buffer and it took more than a day until I stopped 
> the procedure, although I could create the layer with Fixed distance 
> buffer function in QGIS in 10 minutes.
> Any idea to accelerate the process of v.buffer ot v.import in GRASS?

I would guess that the difference comes from the difference in output
format: QGIS will just create non-topological, overlapping buffers (unless you ask it to create unique buffers) while GRASS has to take care of all the topological issues in order to create a topologically clean vector map.

The same is true both for buffer creation and for import.

> 
> Also I want to calculate statistics in each of the buffers and have 
> the same issue with v.rast.stats function

You might get faster results rasterizing your buffers and using r.univar with the zones= parameter. You can then import the resulting text file into your database and link it to the vector map, as long as you make sure that the pixel values in the zone map correspond to the cat values of the vector map.

> 
> Another issue with this function is a lot of NAs in the result. No 
> hole exists in the raster files and it should be something with 
> snapping I guess which results in removal of many points.

You would have to be a bit more precise about what exactly you are doing and what exactly the results are. Are you talking about points or polygons ?

Moritz


_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list