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

Moritz Lennert mlennert at club.worldonline.be
Tue Jul 9 06:45:59 PDT 2013


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