Preserve certain nodes during smoothing even if they are pseudo nodes #177
Labels
feature 🎁
Request a new feature
to_spatial_smooth
All issues related to function `to_spatial_smooth()`
Is your feature request related to a problem? Please describe.
The
to_spatial_smooth()
morpher now removes all pseudo nodes from the network. The goal of removing pseudo nodes is mainly to speed-up routing tasks. When routing,st_network_paths()
finds the nearest nodes to origin and destination points. In the original network, such a nearest node might have been a pseudo node. Since you smoothed your network before routing, however, all these pseudo nodes are gone and the nearest node to a point is now basically the nearest junction node. This will give less accurate shortest paths.Describe the solution you'd like
It would be nice if you can "protect" some nodes from being smoothed out. E.g. a vector of booleans defining for every node if this node should be protected or not. If
TRUE
, such a node will not be smoothed out, even if it is a pseudo node. By default we can set this boolean vector to contain onlyFALSE
values, i.e. all nodes that are pseudo nodes will be smoothed out.In this way, you can first find the nearest nodes to your origin and destination points (or blend these points into the network with
st_network_blend()
), then smooth the network but protecting these nearest/blended nodes, and then route.This is similar to the
verts
argument indodgr::dodgr_contract_graph()
, see here.The text was updated successfully, but these errors were encountered: