Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid LineStrings in routes_fast_sf #541

Closed
JosiahParry opened this issue Sep 30, 2023 · 1 comment · Fixed by #543
Closed

Invalid LineStrings in routes_fast_sf #541

JosiahParry opened this issue Sep 30, 2023 · 1 comment · Fixed by #543

Comments

@JosiahParry
Copy link
Contributor

The object routes_fast_sf has 7 LINESTRINGs where the start and ending point are identical. As documented in JTS

"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
@Robinlovelace
Copy link
Member

Agreed, this is because sf objects allow non-standard linestrings. Let's be faithful to the original specs. Will update.

Robinlovelace added a commit that referenced this issue Sep 30, 2023
@Robinlovelace Robinlovelace linked a pull request Sep 30, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants