rnetj$angle_2 = sapply(1:nrow(rnetj), function(i) {
# Check if either of the geometries is empty
if (st_is_empty(rnetj$corr_line_geometry_buffer[i]) ||
st_is_empty(rnetj$corr_line_geometry_point[i])) {
return(NA)
}
# Extract the two lines into a temporary 'sf' object
temp_sf <- rbind(
data.frame(geometry = rnetj$corr_line_geometry_buffer[i]),
data.frame(geometry = rnetj$corr_line_geometry_point[i])
)
temp_sf <- st_as_sf(temp_sf)
# Get the angles difference using the temporary 'sf' object
angles = angle_diff(temp_sf, angle = 0)
# Return the absolute difference between the two angles
abs(angles[1] - angles[2])
})
There are some noticeable inconsistencies causing the problem. For example :
Would you like me to investigate and identify the issue? or use calculate_angle/get_vector to test on 3km dataset?
Hi @Robinlovelace, I am reviewing the results obtained from angle_diff function and from calculate_angle/get_vector.
There are some noticeable inconsistencies causing the problem. For example :
Would you like me to investigate and identify the issue? or use calculate_angle/get_vector to test on 3km dataset?