st_normalize {transformr}R Documentation

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

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)


[Package transformr version 0.1.5 Index]