geo_translate: Translate geometric objects

View source: R/geo_translate.R

geo_translateR Documentation

Translate geometric objects

Description

Translate geometric objects by adding a constant in x and y dimension.

Usage

geo_translate(obj, x = NULL, y = NULL, fid = NULL, update = TRUE)

Arguments

obj

gridded(1)
the object to translate.

x

numeric(1)
the translation constant (offset) in x dimension.

y

numeric(1)
the translation constant (offset) in y dimension.

fid

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

update

logical(1)
whether or not to update the window slot after translation.

Value

geom of the mathematically translated obj.

See Also

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

Examples

# translate several features
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_translate(obj = gtGeoms$polygon, x = 5, y = c(-10, 5),
                        update = FALSE)
geo_vis(geom = newPoly, linecol = "green", new = FALSE)

# translate a single feature
geo_vis(gtGeoms$polygon, linewidth = 3)
newPoly <- geo_translate(obj = gtGeoms$polygon, x = 5, fid = 2,
                        update = FALSE)
geo_vis(geom = newPoly, linecol = "green", new = FALSE)

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