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!
Cheers,
Paolo
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
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…
thanks,
Paolo
···
2013/7/9 Moritz Lennert <mlennert@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
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.
?
Moritz
thanks,
Paolo
2013/7/9 Moritz Lennert <mlennert@club.worldonline.be
<mailto:mlennert@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
Hi Paolo,
On Tuesday 09 Jul 2013 13:21:41 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!
I'm not sure that I have understood your problem...
but maybe you can transform the raster into a vector and then check which
polygons of your vector maps are contained/overlapped in the raster area...
All the best.
Pietro