Learn R Programming

tmap (version 1.6)

approx_areas: Approximate area sizes of the shapes

Description

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

Usage

approx_areas(shp, unit = "km", unit.size = 1000, total.area = NA)

Arguments

shp
shape object, i.e., a SpatialPolygons(DataFrame)
unit
one of

The default method is "km".

unit.size
size of the unit in terms of coordinate units. The coordinate system of many projections is approximately in meters while thematic maps typically range many kilometers, so by default unit="km" and unit.size=1000 (meaning 1 kilometer equals 1000 coordinate units).
total.area
total area size of shp in number of squared units (by default kilometers). Useful if the total area of the shp differs from a reference total area value.

Value

Numeric vector of area sizes.

Details

To approximate the sizes in squared units, either the total.area or the unit.size 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(NLD_muni)

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

tm_shape(NLD_muni) +
	tm_bubbles(size="area", title.size=expression("Area in " * km^2))

Run the code above in your browser using DataLab