Calculate the length of feature axes of an sf polygon
Source:R/shapeMetricsFromSF.R
st_feature_axes.Rd
Calculate the length of feature axes of an sf polygon
Examples
matrix_R <- matrix(c(
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 1, 1, 0, 1, 1, 0, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 1, 1, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
), nrow = 9, byrow = TRUE)
poly_R <- binaryImageToSF(matrix_R, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
st_feature_axes(poly_R)
#> $majorAxisLength
#> [1] 0.7777778
#>
#> $minorAxisLength
#> [1] 0.6666667
#>