Nudge SpatialPolygons
nudge_sp(sp = NULL, sp_nudge = NULL, ...)
sp::SpatialPolygons
object
list
whose names are found in names(sp)
,
and whose values are x
and y
coordinates to be moved.
additional arguments are ignored.
numeric
value in degrees (0, 360) to
rotate the sp
object and all contained polygons. (Not yet
implemented.)
object sp::SpatialPolygons
.
This helper function is intended to take sp::SpatialPolygons
and "nudge" (move by adding a scalar value to each coordinate)
only a subset of polygons identified by name.
It differs from rescale_sp()
because rescale_sp()
manipulates
all contained polygons together.
Other venndir spatial:
degrees_to_adj()
,
diff_degrees()
,
display_angles()
,
get_largest_polygon()
,
get_sp_buffer()
,
intersect_polygons()
,
mean_degree_arc()
,
mean_degrees()
,
rescale_coordinates()
,
rescale_sp()
,
sp_circles()
,
sp_ellipses()
,
spread_degrees()
,
union_polygons()
sp <- sp_ellipses(c(3, 2), c(2, 3),
xradius=c(1, 4),
yradius=c(5, 2))
opar <- par("mfrow"=c(1,2));
on.exit(par(opar));
plot(sp, col=c("#FF000077", "#FFDD0077"),
xlim=c(-2, 9));
axis(1, las=2); axis(2, las=2);
points(x=c(3, 2), y=c(2, 3), pch=c("1", "2"), add=TRUE);
sp2 <- nudge_sp(sp,
sp_nudge=list("2"=c(3, -2))
)
plot(sp2, col=c("#FF000077", "#FFDD0077"),
xlim=c(-2, 9));
plot(sp[2], border="blue", lty="dotted", add=TRUE);
axis(1, las=2); axis(2, las=2);
arrows(x0=2, x1=5, y0=3, y1=1)
points(x=c(3, 5), y=c(2, 1), pch=c("1", "2"), add=TRUE);