How does RivEX generate random points?

Tools ›› Sample network ››
Parent Previous Next

RivEX is capable of generating random points upon a river network.  It achieves this by reading the network and constructing a virtual line which it then generates a random distance along.  This method has the advantage that it generates a point on the network thus no snapping is required.


In the image below you see a network where each polyline is labelled with its ID and polyline length. The network is composed of 7 polylines and has a total length of 1120m.

Example network

RivEX constructs a virtual line in memory (using a data structure called a dictionary). The above example is visualised below, each polyline contributes a distance along the virtual line. Their individual contribution ( or position along the virtual line) is determined by there position in the FeatureClass table (i.e. the order they were digitized)

Virtual line

RivEX then generates a random number between zero and the total length.  For example a distance of 500m along the virtual line would place it on polyline 4. Polylines 1, 2 & 3 account for the first 495m of the 500m.

Virtual line

This step is repeated for as many times as it is required.


RivEX can fail to locate a point upon the network.  Reasons could be: large exclusion zones eliminating large sections of the network or too little network within the stratifying polygon.  For these reasons RivEX will try a further 200 random locations along the virtual line before bailing out and moving on to the point. In the image below the central grid cell intersects a single polyline (highlighted) in its top left corner, but only a fraction of the polyline is actually within the grid cell. This means RivEX could easily fail to apply the full number of points per cell, especially if the user has applied an exclusion zone.


Failed to sample