Hi all,
I noticed that st_snap is returning the start/end point of the closest linestring. Is the the expected behavior of the function? I was expecting that st_snap would work similarly to maptools::snapPointsToLines and snap a point to the closest point on a line segment.
There is a reproducible example here.
No, it is a straight copy of PostGIS' st_snap.
Thank you for the clarification, @edzer . Are there any plans to create an sf function similar to maptools::snapPointsToLines ?
@tim-salabim gave you a good suggestion on SO; with st_length you seem to have what you're looking for. Please choose whether to pursue this issue here, or on SO.
Hi @edzer . Yes, @tim-salabim provided a good workaround to the problem and I'm grateful for that. :) Nevertheless, that's still just a workaround, hence my previous question whether there are any plans to develop a built-in function in sf that works similarly to maptools::snapPointsToLines. I think this could be a valuable function for future versions of sf but I understand if you don't think that's worth pursuing here.
See st_nearest_points.
Most helpful comment
Hi @edzer . Yes, @tim-salabim provided a good workaround to the problem and I'm grateful for that. :) Nevertheless, that's still just a workaround, hence my previous question whether there are any plans to develop a built-in function in
sfthat works similarly tomaptools::snapPointsToLines. I think this could be a valuable function for future versions ofsfbut I understand if you don't think that's worth pursuing here.