geo_scale: Scale geometric objects

View source: R/geo_scale.R

geo_scaleR Documentation

Scale geometric objects

Description

Scale the vertex values of geometric objects to a values range.

Usage

geo_scale(obj, range = NULL, fid = NULL, update = TRUE)

Arguments

obj

gridded(1)
the object to be scaled.

range

data.frame(2)
vector of length two for both of the x and y dimension to which the values should be scaled.

fid

integerish(.)
in case only a subset of features shall be scaled, specify that here.

update

logical(1)
whether or not to update the window slot of the resulting geom.

Value

geom of the scaled obj.

See Also

Other geometry tools: geo_filter(), geo_locate(), geo_pull(), geo_reflect(), geo_rotate(), geo_skew(), geo_stretch(), geo_translate()

Examples

# rescale to values between -10 and 10
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_scale(obj = gtGeoms$polygon, update = FALSE,
                     range = data.frame(x = c(-10, 10), y = c(-10, 10)))
geo_vis(geom = newPoly, linecol = "green", new = FALSE)

# rescale a single feature
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_scale(obj = gtGeoms$polygon, update = FALSE, fid = 2,
                     range = data.frame(x = c(-10, 10), y = c(-10, 10)))
geo_vis(geom = newPoly, linecol = "green", new = FALSE)

EhrmannS/geometr documentation built on Jan. 31, 2024, 9:13 a.m.