Closed JosiahParry closed 9 months ago
The object routes_fast_sf has 7 LINESTRINGs where the start and ending point are identical. As documented in JTS
routes_fast_sf
LINESTRING
"Linestrings with exactly two identical points are invalid."
library(stplanr) routes_fast_sf[which(n_vertices(routes_fast_sf) == 2), "geometry"] |> sf::st_coordinates() #> X Y L1 #> [1,] -1.516734 53.82887 1 #> [2,] -1.516734 53.82887 1 #> [3,] -1.535617 53.82847 2 #> [4,] -1.535617 53.82847 2 #> [5,] -1.550807 53.82442 3 #> [6,] -1.550807 53.82442 3 #> [7,] -1.530712 53.81756 4 #> [8,] -1.530712 53.81756 4 #> [9,] -1.519318 53.81580 5 #> [10,] -1.519318 53.81580 5 #> [11,] -1.511861 53.81161 6 #> [12,] -1.511861 53.81161 6 #> [13,] -1.524205 53.80410 7 #> [14,] -1.524205 53.80410 7
Agreed, this is because sf objects allow non-standard linestrings. Let's be faithful to the original specs. Will update.
sf
The object
routes_fast_sf
has 7LINESTRING
s where the start and ending point are identical. As documented in JTS