deform: Deform basemap.

Description Usage Arguments Value Examples

View source: R/deform.R

Description

Deform basemap.

Usage

1
deform(x, flatten = 0.8, rescale = c(1.3, 2))

Arguments

x

an sf object (polygon or multipolygons).

flatten

numerical value indicating the scaling in Y (1 = no flattening).

rescale

a vector of two numeric values indicating the deformation of the top and bottom of the figure (c(1,1) = no deformation).

Value

an sf object (polygon or multipolygons).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
library(sf)
us <- st_read(system.file("us.gpkg", package="mapextrud"))
f <- getframe(us)
us2 <- deform(us)
# Example 1 (default values)
f2 <- deform(f)
plot(st_geometry(f2))
plot(st_geometry(us2), add = TRUE)
# Exemple 2 (user values)
us3 <- deform(us, flatten=0.5, rescale = c(0.5, 3))
f3 <- deform(f, flatten=0.5, rescale = c(0.5, 3))
plot(st_geometry(f3))
plot(st_geometry(us3), add = TRUE)

neocarto/mapextrud documentation built on April 10, 2020, 12:13 a.m.