for a project I would be in need to rasterize vector polygons with
attribute value to the raster model where the resulting raster cells
carry the weighted portion of the original attribute according to
the area covered.
Example:
A square vector polygon with value 10.000 falls onto four raster
cells. The resulting cells should each carry the value 2.500.
I wonder if the mechanism used in r.resamp.stats for -w:
Weight according to area
could be implemented in v.to.rast to achieve this goal.
Markus,
The first thing that occurs to me is to make the value of the first raster from the polygon layer the area of the polygon. r.mapcalculator to divide the value of each raster by the area of a raster cell. This should give you a raster with the value of the proportion of area of the polygon in each cell.
Now rasterize the polygon layer with the original attribute you wanted to affect. Multiply this raster by the proportional raster above.
A bit brute force, but it should give you what you want.
Doug
On Thu, Nov 8, 2012 at 5:29 AM, Markus Neteler <neteler@osgeo.org> wrote:
Hi all,
for a project I would be in need to rasterize vector polygons with
attribute value to the raster model where the resulting raster cells
carry the weighted portion of the original attribute according to
the area covered.
Example:
A square vector polygon with value 10.000 falls onto four raster
cells. The resulting cells should each carry the value 2.500.
I wonder if the mechanism used in r.resamp.stats for -w:
Weight according to area
could be implemented in v.to.rast to achieve this goal.
r.mapcalculator to divide the value of each raster by the area of a raster cell.
This should be divide the area of a cell by the value of the raster ( from the polygon). Sorry, no caffeine yet this morning.
Markus,
The first thing that occurs to me is to make the value of the first raster from the polygon layer the area of the polygon. r.mapcalculator to divide the value of each raster by the area of a raster cell. This should give you a raster with the value of the proportion of area of the polygon in each cell.
Now rasterize the polygon layer with the original attribute you wanted to affect. Multiply this raster by the proportional raster above.
A bit brute force, but it should give you what you want.
Doug
On Thu, Nov 8, 2012 at 5:29 AM, Markus Neteler <neteler@osgeo.org> wrote:
Hi all,
for a project I would be in need to rasterize vector polygons with
attribute value to the raster model where the resulting raster cells
carry the weighted portion of the original attribute according to
the area covered.
Example:
A square vector polygon with value 10.000 falls onto four raster
cells. The resulting cells should each carry the value 2.500.
I wonder if the mechanism used in r.resamp.stats for -w:
Weight according to area
could be implemented in v.to.rast to achieve this goal.