cartogramR: Make a continuous cartogram (density equalizing maps)

View source: R/cartogramR.R

cartogramRR Documentation

Make a continuous cartogram (density equalizing maps)

Description

Make a continuous cartogram (density equalizing maps)

Usage

cartogramR(
  data,
  count,
  method = c("gsm", "gn", "dcn", "GastnerSeguyMore", "GastnerNewman",
    "DougenikChrismanNiemeyer"),
  options = NULL
)

Arguments

data

a sf object which contains at least two columns: obviously a geometry column (giving the map) and a column which contains a count by region (leading to a density by region, density to be equalized by deformation). Each row of data is a region and contains the simple feature geometry of type POLYGON or MULTIPOLYGON. Polygon ring directions are not checked but exterior ring must counter clockwise and holes clockwise (use option check_ring_dir of sf::st_read to achieve the right orientation of ring direction on import or use check_ring_dir function)

count

a character string which indicates the name of the column (in data object) which contains the count by region.

method

the method to be used, can be one of the following: gsm or GastnerSeguyMore (default), gn or GastnerNewman, dcn or DougenikChrismanNiemeyer.

options

a named list given to cartogramR_options function which process options see cartogramR_options for details. Default to NULL.

Value

A cartogramR object: a list with the following components:

  • cartogram: a sf object (in the same order of data or sorted by idregion see reordered argument) which contains the initial data (without the geometry) with three additionnal columns (orig_area: original areas of regions, final_area: final areas of regions in the cartogram and target_areas the targeted area) and a geometry part which is the cartogram (ie the initial polygons after deformation)

  • orig_centers: the initial centers calculated with sf::st_point_on_surface

  • final_centers: the centers after deformation

  • gridx: (for flow-based method) final grid (x-axis) if requested (see cartogramR_options for details).

  • gridy: (for flow-based method) final grid (y-axis) if requested (see cartogramR_options for details). with additionnal attributes.

References

  • Dougenik, J., Chrisman, R. & Niemeyer, D. (1985). An algorithm to construct continuous area cartograms. Professional Geographer 37: 75-81.

  • Gastner, M. & Newman, M.E.J. (2004). Diffusion-based method for producing density equalizing maps. Proc. Natl. Acad. Sci. USA, 101:7499-7504

  • Gastner, M., Seguy, V. & More, P. (2018). Fast flow-based algorithm for creating density-equalizing map projections. Proceedings of the National Academy of Sciences USA, 115:E2156-E2164, website: go-cart

Examples


  data(usa)
  carto <- cartogramR(usa, "electors64")
  plot(carto)
  summary(carto)



cartogramR documentation built on Sept. 11, 2024, 5:48 p.m.