Closed luukvdmeer closed 3 years ago
This is solved now with the new st_network_blend implementation:
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.0, PROJ 7.2.0
library(sfnetworks)
p1 = st_point(c(0.532442, 1.95422))
p2 = st_point(c(0.53236, 1.95377))
p3 = st_point(c(0.53209, 1.95328))
l1 = st_sfc(st_linestring(c(p1, p2, p3)))
p4 = st_point(c(0.53209, 1.95345))
p5 = st_point(c(0.53245, 1.95345))
l2 = st_sfc(st_linestring(c(p4, p5)))
net = as_sfnetwork(l1)
p = st_intersection(l1, l2)
st_network_blend(net, p)
#> # A sfnetwork with 3 nodes and 2 edges
#> #
#> # CRS: NA
#> #
#> # A rooted tree with spatially explicit edges
#> #
#> # Node Data: 3 x 1 (active)
#> # Geometry type: POINT
#> # Dimension: XY
#> # Bounding box: xmin: 0.53209 ymin: 1.95328 xmax: 0.532442 ymax: 1.95422
#> x
#> <POINT>
#> 1 (0.532442 1.95422)
#> 2 (0.53209 1.95328)
#> 3 (0.5321837 1.95345)
#> #
#> # Edge Data: 2 x 3
#> # Geometry type: LINESTRING
#> # Dimension: XY
#> # Bounding box: xmin: 0.53209 ymin: 1.95328 xmax: 0.532442 ymax: 1.95422
#> from to x
#> <int> <int> <LINESTRING>
#> 1 1 3 (0.532442 1.95422, 0.53236 1.95377, 0.5321837 1.95345)
#> 2 3 2 (0.5321837 1.95345, 0.53209 1.95328)
Created on 2021-03-03 by the reprex package (v0.3.0)
Describe the bug When trying to blend a point that is extremely close to its nearest edge,
st_network_blend
fails.Reproducible example
Created on 2020-12-14 by the reprex package (v0.3.0)
Expected behavior Blend the point no matter the distance to its nearest edge.