[R-sig-Geo] Find nearest downstream value of a river network

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu May 19 18:06:57 CEST 2011


On Thu, May 19, 2011 at 4:17 PM, Edzer Pebesma
<edzer.pebesma at uni-muenster.de> wrote:

> Does that get you any further? Or are there more clever solutions?

>> So far I have got the result in this plot from an iterative procedure
>> using the FROMJCT and TOJCT (from and to junction) IDs of the data.frame:

 If the FROMJCT and TOJCT numbers define nodes of a graph, and the
presence of a row with FROMJCT=a and TOJCT=b defines an edge from a to
b of the graph, then you could use something like R's igraph package
to build a graph object. Once you've done that it should be easy to
use the graph algorithms in that package to wander down the river
system at your leisure...

 It might get complicated if you are modelling on the Orinoco where it
bifurcates, or a river delta :)

 Will have a play now at the end of the working day while waiting for
the Indian Premier League Cricket to start up again...

Barry



More information about the R-sig-Geo mailing list