Skip to content
Prev 4904 / 29559 Next

calculate raster values based on vector regions

Hi list,

I try to explain my problem a bit better.

1) Vector and raster have the same extent.

2) Vector data:
Several polygones with different attribute values
3) raster data:
A raster with points over the areas (and also NAs for areas where it is not possible to have a value from polygones). These points need to get the polygon attribute values assigned

Vector                    Raster                  after assiging polygon values to raster
-----------             ------------          ------------
|   3   |  1    |          | +na + + na |        |3na 3 1 na  |
|-----------|          | na na  na na|        |na na  na na|
|    7  | 5     |          |++na  na +  |        |7 7na na 5  |
-----------            -------------        -------------

+ denotes a raster value

Does this make more sense?

In gdal/fwtools is a function rgdal_rasterize, which could potentially do this, but I'd rather to all in R.

Cheers and thanks
Herry