bboxing <- function(input_point) {
sf::st_bbox(
c(
xmin = sf::st_coordinates(input_point)[1] - 1000,
xmax = sf::st_coordinates(input_point)[1] + 1000,
ymax = sf::st_coordinates(input_point)[2] + 1000,
ymin = sf::st_coordinates(input_point)[2] - 1000
),
crs = sf::st_crs(3035)
)
}
bboxing function and store the results in a new object. What do you think is the function doing?
osmdata::getbb() and so on.
sf::st_crop() function.
Use the following function for shearing and rotating your layers. Run the code first before applying it.
rotate_data <- function(data, x_add = 0, y_add = 0) {
shear_matrix <- function () {
matrix(c(2, 1.2, 0, 1), 2, 2)
}
rotate_matrix <- function(x) {
matrix(c(cos(x), sin(x), -sin(x), cos(x)), 2, 2)
}
data %>%
dplyr::mutate(
geometry =
.$geometry * shear_matrix() * rotate_matrix(pi/20) + c(x_add, y_add)
)
}
rotate_data() function.
gpplot() and store them in a separate object. Or, you can do that on the fly within the geom_sf() call.