[R-sig-Geo] Calculating what proportion of polygons is covered by rivers

Robert J. Hijmans r.hijmans at gmail.com
Mon Dec 1 09:24:09 CET 2014


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 you
> go about calculating what proportion of districts is covered by rivers and
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list