transformr (version 0.1.1)

st_normalize: Normalise a geometry to fit inside a unit square

Description

This is a small helper function that will take an sf geometry and fit it inside the unit square (a square centered on 0 and ranging from -1 to 1 in both dimensions). The function will retain the aspect ratio of the geometry and simply scale it down until it fits.

Usage

st_normalize(st)

Arguments

st

An sf geometry such as sf, sfc, or sfg

Value

An object of the same type as st

Examples

Run this code
# NOT RUN {
library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
st_bbox(nc)

nc_norm <- st_normalize(nc)
st_bbox(nc_norm)

# }

Run the code above in your browser using DataCamp Workspace