warp_features: Apply the deformation used to build a cartogram to a set of...

View source: R/warp_features.R

warp_featuresR Documentation

Apply the deformation used to build a cartogram to a set of simple geometry coordinates

Description

Apply the deformation used to build a cartogram to a set of simple geometry coordinates or simple features. The resulting simple geometry object can be used to add geometry features on the cartogram.

Usage

warp_features(sfgeom, carto, verbose = FALSE)

Arguments

sfgeom

a sf or a sfc object which contains simple feature geometry of types in the following POINT, MULTIPOINT, LINESTRING, MULTILINESTRING, POLYGON, 'MULTIPOLYGON

carto

a cartogramR object

verbose

a boolean object to set on verbose mode (default to FALSE)

Value

a sf or a sfc object which contains simple feature geometry transformed

Examples


  data(usa)
  carto <- cartogramR(usa, "electors64")
  LA <- sf::st_sfc(sf::st_point(c(-118.243685, 34.052234)))
  sf::st_crs(LA) <- 4326
  moregeom <- warp_features(LA, carto)
  plot(carto)
  plot(moregeom, add=TRUE, col=2, pch=15)



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