-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
When the input data are in a projected CRS, align_move() calls sf::st_line_interpolate() with normalized distances:
Line 150 in cf88cdc
| m_aligned <- mapply(.m = m_sf_lines, .nd = nd, function(.m, .nd) st_line_interpolate(st_geometry(.m), .nd), SIMPLIFY = T) |
However, st_line_interpolate() defaults to normalized = FALSE and interprets the interpolation distance values in map units. This produces animations where the tracks appear not to deviate from their start locations.
This doesn't happen with geographic coordinates because the function instead calls s2_interpolate_normalized() which uses normalized distances by default.
Reprex:
library(moveVis)
#> Read our accompanying open-access paper published in 'Methods in
#> Ecology and Evolution': https://doi.org/10.1111/2041-210X.13374
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
data("move_data")
m <- align_move(move_data)
#> Temporal resolution of 3.96 [min] is used to align trajectories.
m_proj <- align_move(st_transform(move_data, "epsg:32637"))
#> Temporal resolution of 3.96 [min] is used to align trajectories.
st_geometry(m)
#> Geometry set for 461 features
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 8.905907 ymin: 47.72767 xmax: 8.991634 ymax: 47.76814
#> Geodetic CRS: WGS 84
#> First 5 geometries:
#> POINT (8.964474 47.7571)
#> POINT (8.962688 47.75754)
#> POINT (8.960687 47.75754)
#> POINT (8.958703 47.75775)
#> POINT (8.956729 47.75799)
st_geometry(m_proj)
#> Geometry set for 461 features
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -1740821 ymin: 5740799 xmax: -1736541 ymax: 5743032
#> Projected CRS: WGS 84 / UTM zone 37N
#> First 5 geometries:
#> POINT (-1736542 5743031)
#> POINT (-1736542 5743031)
#> POINT (-1736542 5743031)
#> POINT (-1736542 5743031)
#> POINT (-1736542 5743031)Metadata
Metadata
Assignees
Labels
No labels