Learn R Programming

tmap (version 0.7)

approx_areas: Approximate area sizes of the shapes

Description

Approximate the area sizes of the polygons either in 1) squared kilometers, 2) absolute numbers based on the polygon coordinates, 3) proportional numbers, 4) normalized numbers.

Usage

approx_areas(shp, total.area.km2 = NA, units = NULL)

Arguments

shp
shape object, i.e. a SpatialPolygons(DataFrame)
total.area.km2
total area size of shp in number of squared kilometers. If NA, and unit="km2", then the polygon coordinates are assumed to be in meters.
units
one of [object Object],[object Object],[object Object],[object Object] The default method is "abs", unless total.area.km2 is specified (in that case, it is "km2").

Value

  • Numeric vector of area sizes.

Details

To approximate the sizes in squared kilometer, total.area.km2 is required. Note that this method is an approximation, since it depends on the used projection and the level of detail of the SpatialPolygons object. Projections with equal-area property are highly recommended.

Examples

Run this code
data(World)

data(NLD_muni)

NLD_muni$area <- approx_areas(NLD_muni, total.area.km2 = 33893)

tm_shape(NLD_muni) +
	tm_bubbles(size="area") +
	tm_layout("Area in km2")

Run the code above in your browser using DataLab