Learn R Programming

tmap (version 0.7)

intersection_shapes: Calculate intersection matrix of two shape objects

Description

The value of row i and column j in the intersection matrix corresponds to the proportion of the area of the i'th polygon of the first shape object that intersects the j'th polygon of the second shape object

Usage

intersection_shapes(shp.from, shp.to, id.from = NULL, id.to = NULL,
  absolute = FALSE)

Arguments

shp.from
the first shape object
shp.to
the second shape object
id.from
name of the data variable of shp.from that contains identification names of the polygons of shp.from. These are used as row names of the intersection matrix.
id.to
name of the data variable of shp.to that contains identification names of the polygons of shp.to. These are used as column names of the intersection matrix.
absolute
should the intersection matrix contain intersection area sizes rather than proportions?

Value

  • Intersection matrix with the number of rows equal to the number of polygons of shp.from and the number of columns equal to the number of polygons of shp.to.

Examples

Run this code
data(NLD_prov)
data(NLD_muni)

m <- intersection_shapes(NLD_muni, NLD_prov, id.from="name", id.to="name")

Run the code above in your browser using DataLab