I have a data frame with the x and y coordinates of the trees recorded in the field. I also have the longitude and latitude of the plot’s corners recorded with the global GNSS.
My plot is not aligned with the Ouest-East and South-North directions. They are inclined (see the screenshot attached).
I would like to know how I can locate my trees in a global system by taking into account the inclination of the plot.
I converted the coordinates of my corners in UTM 34S, and I add the x and y of each tree to find their coordinates in a global system, however many points were outside of the plot as my plot is inclined. I have tried to find the angle of inclination by this formula
# coordinate of the corners de GPS01 (south-west corner) et GPS02 (north-west corner)
gps01 <- c(365648.8342, 7985404.999)
gps02 <- c(365637.2736, 7985427.049)
# Calculate the angle of décalage in radians
angle_decalage_rad <- atan2(gps02[1] - gps01[1], gps02[2] - gps01[2])
# convert the angle in degree
angle_decalage_deg <- angle_decalage_rad * (180 / pi)
rotation_matrix <- matrix(c(cos(angle_decalage_rad), -sin(angle_decalage_rad),
sin(angle_decalage_rad), cos(angle_decalage_rad)),
ncol = 2, byrow = TRUE)
# Appliquer la rotation aux coordonnées des arbres
coords_rotated <- st_coordinates(sf_field_ov_H1_GNSS) %*% rotation_matrix
# Créer un objet sf avec les nouvelles coordonnées
new_geometries <- st_sfc(lapply(1:nrow(coords_rotated), function(i) {
st_point(c(coords_rotated[i, 1], coords_rotated[i, 2]))
}))
hermane diesse is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
6