Juta,
I think you can do something along these lines:
library(raster)
library(rgeos)
x <- union(districts, rivers)
a <- gArea(x, byid=TRUE)
head(x)
head(a)
or
x <- intersect(districts, rivers)
and compare to 'districts'
Robert
On Sun, Nov 30, 2014 at 2:59 PM, Juta Kawalerowicz
<juta.kawalerowicz at nuffield.ox.ac.uk> wrote:
Hi, I have question - I am looking for ideas how to proceed.
I have a SpatialPolygonsDataFrame with polygons (300) representing
districts. Another SpatialPolygonsDataFrame has 700 polygons and these
polygons represent rivers and flooding areas. My question is how would
go about calculating what proportion of districts is covered by rivers
flooding areas?
My first intuition was to rasterize it and then use the extract function
but maybe I am overcomplicating this. Any ideas would be appreciated.
Thanks,
Juta
[[alternative HTML version deleted]]