polygon over or intersect with more than 2 files/layers
On Thu, 31 May 2018, Bannar-Martin, Katherine wrote:
Hi, I've had no success at finding a tool in an R package that can calculate the intersection/overlap of polygons for more than 2 layers. e.g. plot(st_intersection(st_union(LateYear2008),st_union(LateYear2009),st_union(LateYear2010),st_union(LateYear2011),st_union(LateYear2012), st_union(LateYear2013),st_union(LateYear2014),st_union(LateYear2015),st_union(LateYear2016),st_union(LateYear2017)), col = 'red',xlim=c(min(d$x),max(d$x)),ylim=c(min(d$y),max(d$y)),axes = TRUE) does NOT work.
Why would you think it might, given that the help page only shows pairs of objects? The underlying code in GEOS is for binary operations. GRASS also handles binary overlay, and the same applies to PostGIS. It might be possible to work out intersection candidates by building trees of envelopes and querying multiple layers based on non-zero envelope intersection, but
Does anyone have any suggestions? Is there a way to save a shapefile with multiple layers of polygons and then run an over/intersection tool.
No, a "shapefile" has one layer only, unless you want a folder with multiple shapefiles. GPKG can take multiple layers, but it isn't obvious why this would help.
I can run each pair-wise overlap between layers in a loop but the number of combinations is long.
Obviously. If you have to have vector, you have to do this pairwise. If raster is an option, probably there are many more possibilities; GRASS r.cross takes multiple raster layers for example.
Efficient solutions welcomed.
... and code contributions ?? Roger
Thanks! Katherine [[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
Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no http://orcid.org/0000-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en