geom
sTranslate geom
s by adding a constant in x and y-dimension.
gt_translate(geom = NULL, x = NULL, y = NULL, fid = NULL, update = TRUE)
[geom(.)
] the object to translate.
[numeric(1)
] the translation constant (offset) in
x-dimension.
[numeric(1)
] the translation constant (offset) in
y-dimension.
[integerish(.)
] if only a subset of features shall be
rotated, specify that here.
[logical(1)
] whether or not to update the window slot
after rotation.
Mathematically translated geom
.
Other geometry tools:
gt_reflect()
,
gt_rotate()
,
gt_scale()
,
gt_sketch()
,
gt_skew()
,
gt_stretch()
# NOT RUN {
# the original object
coords <- data.frame(x = c(30, 60, 60, 40, 10, 40, 20),
y = c(40, 40, 60, 70, 10, 20, 40),
fid = c(1, 1, 1, 1, 2, 2, 2))
window <- data.frame(x = c(0, 80),
y = c(0, 80))
aGeom <- gs_polygon(anchor = coords, window = window)
# translate several geoms
visualise(geom = gt_translate(geom = aGeom, x = 5, y = list(-10, 5)))
# translate a single geom
visualise(geom = gt_translate(geom = aGeom, x = 5, fid = 1))
# }
Run the code above in your browser using DataLab