7.1 sp
objects
7.1.1 Subset
A quick subset:
#R> [1] "SpatialPolygonsDataFrame"
#R> attr(,"package")
#R> [1] "sp"
Let’s plot our selection:
7.1.2 Unions
Let’s do the union of a selection of spatial polygons:
bel_south <- gUnionCascaded(bel_slc)
bel_north <- gUnionCascaded(bel2[-slc, ])
bel_one <- gUnionCascaded(bel2)
par(mfrow = c(1, 3), mar = c(1, 1, 1, 1))
plot(bel_south)
plot(bel_north)
plot(bel_one)
Let’s combine them on one plot:
7.1.3 Buffers
Buffer must be done on planar coordinates.
#R> Warning: GEOS support is provided by the sf and terra packages among others
#R> Warning in gBuffer(bel_south, width = 0.4): Spatial object is not projected;
#R> GEOS expects planar coordinates
#R> Warning: GEOS support is provided by the sf and terra packages among others
#R> Warning in gBuffer(bel_north, width = 0.1): Spatial object is not projected;
#R> GEOS expects planar coordinates
7.1.4 Intersections
Intersections between bel_south
and bel_north
:
par(mfrow = c(1, 2))
plot(bel_one)
plot(gIntersection(bel_south, bel_north), col = 5, add = TRUE, lwd = 2)
#R> Warning: GEOS support is provided by the sf and terra packages among others
#R> Warning: GEOS support is provided by the sf and terra packages among others