[GRASS-user] Overlaying vector with raster-computational problems

Moritz Lennert mlennert at club.worldonline.be
Tue Jul 9 07:28:23 PDT 2013

On 09/07/13 16:04, Paolo Ruzza wrote:
> Thanks for the suggestion, but if I think that if I follow the procedure
> which you have indicated I will only be able to partially solve my
> problem. What about those parts of the polygons that are not boundaries?
> These might well overlap with certain cells of the raster grid...

Maybe in two steps:

- First use v.to.rast to transform the polygons to raster at current 
resolution. This raster will have null pixels for very small islands.

- Then use the v.to.points solution to also catch those pixels with 
small islands.

- Then r.patch to put the two together.



> thanks,
> Paolo
> 2013/7/9 Moritz Lennert <mlennert at club.worldonline.be
> <mailto:mlennert at club.worldonline.be>>
>     On 09/07/13 13:21, Paolo Ruzza wrote:
>         Dear GRASS users,
>         I am confronted with a "non-standard" problem and I would
>         appreciate any
>         help that you can give me. I have several vector files
>         (polygons) and an
>         arbitrary raster grid, only with category numbers associated to
>         it. I
>         would like to overlay the vectors onto the raster grid in order
>         to query
>         it and extract the categories of the raster grid which overlap
>         with the
>         polygons of each vector file. I am not interested in getting any
>         info
>         from the vector polygons, I just want know where the vector and the
>         raster overlap. I have already thought of a way of doing this-I
>         guess it
>         would naturally come to mind of every GRASS user. This would involve
>         converting the vectors into a rasters and then query the raster
>         grid and
>         the rasterized vectors with r.stats. This would be very easy to
>         do, but
>         my vectors have very small islands, which can, of course, be
>         converted
>         into raster cells, if I set them my region to a very fine resolution
>         for. However, if I went down this route, this would: i)
>         massively slow
>         down vector to raster conversion ii) massively slow down the r.stats
>         querying process. Just to give you an idea of the magnitude of my
>         problem I am using several vector layers (hundreds) at global
>         level and
>         a raster grid at a 2 arc-minutes resolution. I am kind of stuck
>         and I am
>         not sure if there is any computationally efficient strategy to
>         do what I
>         want. Any help would be greatly appreciated!
>     One possible option I see allowing you to keep your original
>     resolution is to use v.to.points (type=boundary and dmax
>     sufficiently small) to transform your polygon boundaries to points,
>     then v.to.rast to transform that to raster.
>     Moritz

More information about the grass-user mailing list