st_normalize {transformr} | R Documentation |
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.
st_normalize(st)
st |
An sf geometry such as |
An object of the same type as st
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)