Translate geometric objects by adding a constant in x and y dimension.
gt_translate(obj, x = NULL, y = NULL, fid = NULL, update = TRUE)
obj | [ |
---|---|
x | [ |
y | [ |
fid | [ |
update | [ |
geom
of the mathematically translated obj
.
Other geometry tools:
gt_filter()
,
gt_locate()
,
gt_pull()
,
gt_reflect()
,
gt_rotate()
,
gt_scale()
,
gt_skew()
,
gt_stretch()
# translate several features visualise(gtGeoms$polygon, linewidth = 3) newPoly <- gt_translate(obj = gtGeoms$polygon, x = 5, y = c(-10, 5), update = FALSE) visualise(geom = newPoly, linecol = "green", new = FALSE) # translate a single feature visualise(gtGeoms$polygon, linewidth = 3) newPoly <- gt_translate(obj = gtGeoms$polygon, x = 5, fid = 2, update = FALSE) visualise(geom = newPoly, linecol = "green", new = FALSE)