Skip to content
Prev 11736 / 29559 Next

Find nearest downstream value of a river network

Hi Jon (thanks for reminding off-list!), I haven't looked into finding
the line with an ID, but in general finding the nearest SpatialLines
index (which of course might be ambiguous) might be done by:

library(rgeos)
d = gDistance(nres, nres, byid=TRUE)
diag(d)=1e9
apply(d,2,function(x)which(x==min(x))[1])

Does that get you any further? Or are there more clever solutions?
--
Edzer
On 04/13/2011 09:59 AM, Jon Olav Skoien wrote: