You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
While working on #211 I noticed that to_spatial_subdivision morpher behaves weirdly when there are identical internal points for a given LINESTRING.
Reproducible example
# packages
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(tidygraph)
#> #> Attaching package: 'tidygraph'#> The following object is masked from 'package:stats':#> #> filter
library(sfnetworks)
# simulate one segment with an internal duplicated pointseg= st_sfc(st_linestring(rbind(c(0, 0), c(1, 0), c(1, 0), c(2, 0))))
sfn= as_sfnetwork(seg)
convert(sfn, to_spatial_subdivision, .clean=TRUE)
#> # A sfnetwork with 3 nodes and 3 edges#> ##> # CRS: NA #> ##> # A directed multigraph with 1 component with spatially explicit edges#> ##> # Node Data: 3 x 1 (active)#> # Geometry type: POINT#> # Dimension: XY#> # Bounding box: xmin: 0 ymin: 0 xmax: 2 ymax: 0#> x#> <POINT>#> 1 (0 0)#> 2 (1 0)#> 3 (2 0)#> ##> # Edge Data: 3 x 3#> # Geometry type: LINESTRING#> # Dimension: XY#> # Bounding box: xmin: 0 ymin: 0 xmax: 2 ymax: 0#> from to x#> <int> <int> <LINESTRING>#> 1 1 2 (0 0, 1 0)#> 2 2 2 (1 0, 1 0)#> 3 2 3 (1 0, 2 0)
It is a weird result, but I am not sure if I find it unexpected. The question is mainly: what should the morpher do when an edge crosses itself, which is essentially what is happening here. I would say it should create a node there. Of course in this specific case the result is weird because the duplicated internal points come directly after each other, and a zero-length loop edge is created.
Do you think that it is worth exploring this problem more precisely and think about a solution? Moreover (but this is probably the topic for a separate issue), to_spatial_smooth doesn't help here.
Describe the bug
While working on #211 I noticed that
to_spatial_subdivision
morpher behaves weirdly when there are identical internal points for a given LINESTRING.Reproducible example
Created on 2022-06-22 by the reprex package (v2.0.1)
Expected behavior
I would say that the morpher should not modify the input edges in this case. What do you think?
R Session Info
Session info
The text was updated successfully, but these errors were encountered: