Open mhweber opened 2 years ago
Wrote this a couple years ago to add the distance from an sf point to the catchment outflow point. I want to say there is an fline upper node as well that could be compared to it instead of having to get the upstream fline. I'd be cautious of comparing this euclidean distance to the fline length though. I haven't dug into the recent release of nhdplusTools, I remember back ~11/2/21 D. Blodgett tweeted something about adding navigation from a point along a network (may or may not relate at all).
distance_catchment_outlet<- function(point, fline) {
#Note: this should only be used on positive pathlength
# point and fline must have matching comid
if(point$comid == fline$comid){
end = get_node(fline, "end")
st_distance(point, end)
} else {
FALSE
#TODO: BREAK LOUDLY
}
}
Thanks Justin - I've been using navigate_nldi from nhdplusTools for other projects - I know Dave has been updating features in nhdplusTools and I added some functionality recently - I'll check and see if specific functionality exists in nhdplusTools already and if not incorporate your suggestion into a package function - thanks!
Suggestion from Leah Ettema: