Stefan, thanks for your recommendation of the igraph-package. This would make indeed sense for more complex analysis. At the moment I am just interested in an GRASS (native) way to get a stream order for a vector network. For this, purpose, and I guess also for using the igraph package, one needs the information of the start (from_node) and endnode (to_node) of each arc. So I am still looking how this information can be extracted in GRASS and e.g. written into the attribute table?!
Best regards, Johannes On Wed, Mar 18, 2015 at 10:43 AM, Blumentrath, Stefan < stefan.blumentr...@nina.no> wrote: > Hi Johannes, > > > > For more complex network analysis I can warmly recommend the igraph > package (http://igraph.org/, which has both Python and R bindings). > > It comes very handy for customized network analysis, is not too > complicated to learn, well documented and quite efficient. > > I could provide you with some sample code in R if that would be of > interest. > > > > Cheers > > Stefan > > > > *From:* grass-user-boun...@lists.osgeo.org [mailto: > grass-user-boun...@lists.osgeo.org] *On Behalf Of *Johannes Radinger > *Sent:* 18. mars 2015 10:30 > *To:* GRASS user list > *Subject:* [GRASS-user] Stream order for vector networks > > > > Hi, > > > > I am interested in calculating stream order (Strahler, Shreve) for stream > networks based on GRASS vector networks (e.g. created by v.net) without > using the raster approach of the GRASS add-on r.stream.order. Therefore, I > came across following paper: > > > > Gleyzer, A., Denisyuk, M., Rimmer, A. and Salingar, Y. (2004), A FAST > RECURSIVE GIS ALGORITHM FOR COMPUTING STRAHLER STREAM ORDER IN BRAIDED AND > NONBRAIDED NETWORKS. JAWRA Journal of the American Water Resources > Association, 40: 937–946. doi: 10.1111/j.1752-1688.2004.tb01057.x > > > > which also provides pseudocode to calculate Strahler order for non-braided > and braided vector networks defined by arcs and nodes. Thus, I am wondering > if it is possible to get the information from which node a specific arc > starts (from_node) and where it drains to (to_node). BTW, I seems some kind > of this information is already provided with the NC-dataset (FNODE_ and > TNODE column) in the streams attribute table, however I don't know where > this information comes from. Of course to extract this information the > network needs to be directed to define what is the upstream and what the > downstream node of each arc. However, having this information available, it > should not be to complicated to apply the algorithm proposed by Gleyzer et > al 2004. Thus I am interested to get 'from_node' and 'to_node' information > e.g. stored in the attribute table of v.net output? > > > > Here the pseudocode provided by Gleyzer et al 2004: > > > > ######################################################################## > > MakeDictionaries(Network) > > 1 for each Arc ∈ Network > > 2 do FromNodesPerArc[Arc's ID] ← Arc’s FromNodeID > > 3 InflowingArcsPerNode[Arc's ToNodeID] ← InflowingArcsPerNode[Arc’s > ToNodeID] ∪ Arc’s ID > > 4 OriginatingNode[Arc's ID] ← Arc’s FromNodeID > > > > StreamOrdering(ArcID) > > 1 Visited[ArcID] ← true > > 2 if | InflowingArcsPerNode[ FromNodesPerArc[ArcID] ] | = 0 > > 3 then StreamOrders[ArcID] ← 1 > > 4 else > > 5 for each Arc ∈ InflowingArcsPerNode[ FromNodesPerArc[ArcID] ] > > 6 do if not Visited[Arc] > > 7 then UpstreamOrders[Arc] ← (StreamOrdering(Arc), OriginatingNode[Arc]) > > 8 else UpstreamOrders[Arc] ← (StreamOrders[Arc], OriginatingNode[Arc]) > > 9 MaxOrder ← 0 > > 10 MaxOrderCount ← 0 > > 11 for each (Order, Origin) ∈ UpstreamOrders > > 12 do if Order > MaxOrder > > 13 then MaxOrder ← Order > > 14 MaxOrderCount ← 1 > > 15 MaxOrderOrigin ← Origin > > 16 else if Order = MaxOrder > > 17 then if Origin ≠ MaxOrderOrigin > > 18 then MaxOrderCount ← MaxOrderCount + 1 > > 19 if MaxOrderCount > 1 > > 20 then StreamOrders[ArcID] ← MaxOrder + 1 > > 21 OriginatingNode[ArcID] ← FromNodesPerArc[ArcID] > > 22 else StreamOrders[ArcID] ← MaxOrder > > 23 OriginatingNode[ArcID] ← MaxOrderOrigin > > 24 if SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ] = nil > > 25 then SegmentIDs[ StreamOrders[ArcID] ] ← SegmentIDs[ > StreamOrders[ArcID] ] + 1 > > 26 SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ] ← SegmentIDs[ > StreamOrders[ArcID] ] > > 27 Segments[ArcID] ← SegmentIDsPerOriginatingNode[ OriginatingNode[ArcID] ] > > 28 return StreamOrders[ArcID] > > ######################################################################## > > > > Is there anyone having experience with that, or has already tried to > implement a vector-stream order approach in GRASS GIS. Specifically I am > interested > > in Shreve stream order for simple (non-braided) stream networks and > Strahler stream order for braided river networks (Gleyzer et al 2004). > > > > Best regards, > > Johannes >
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user