transform_to_inset {ggmapinset}R Documentation

Transform coordinates according to inset configuration

Description

This helper operates on an sf object to scale and translate its geometry according to the inset specification.

Usage

transform_to_inset(x, inset)

Arguments

x

Spatial data frame or other sf object; see sf::st_geometry().

inset

Inset configuration; see configure_inset().

Value

A copy of x with the geometry replaced by the transformed version.

Examples

library(sf)

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
cfg <- configure_inset(
  centre = st_sfc(st_point(c(-82, 35)), crs = 4326),
  scale = 2,
  translation = c(10, -60),
  radius = 50,
  units = "mi")

transform_to_inset(nc, cfg)

[Package ggmapinset version 0.3.0 Index]