Link sites (within a layer)

Parent Previous Next

The algorithm employed by RivEX can fail to identify the nearest site if the site is on one side of a loop in the network.  The row order in a network layer influences the sequence that polylines are visited under this scenario so its possible for RivEX to traverse a network and miss a site. The Author of RivEX is seeking to develop a more robust algorithm to over come this problem.

RivEX can generate routes between sites within a single layer. A route is a polyline showing the path travelled to link one site to another. This is useful in visualizing a link between 2 sites. You could use the polyline is a spatial selection against other datasets.

The route returned is the link to the NEAREST site. This tool will generate only one link FROM a site to a valid nearest site.

The number of routes RivEX must test is number of sites2, thus a dataset of 1000 sites would mean 1,000,000 combinations.  Fortunately RivEX will never test this number as the linking process is optimised:

oSites are first sorted into catchments.  Linking is never attempted across catchments as these sites could never possibly be linked. A catchment is defined as all polylines flowing to a network mouth.

RivEX does not use a shortest path algorithm when attempting to link 2 sites.  For each site a route to the river mouth is generated and these are intersected.  Where they share a common path this is removed and what's left is the route that links both sites.  See image below.

How linking works

You can generate routes in an upstream or downstream direction. These are written to separate FeatureClasses  starting with the name fcSiteLinks_US_x or fcSiteLinks_DS_x where x is the site layer name.

The link layers are stored in the File GeoDatabase fGDB_SiteLinking.gdb which is found in the ..\RivEX_Workspace\Output folder.

Link sites dialog

Enabling enforce route to source will influence the linking process. To be able to use this you need to have the source ID encoded into the point dataset. Click here to find out how to achieve this.

All RivEX generated fields must exist before this tool can be used. Click OK and the tool will execute.

The output FeatureClass will contain the following fields:

Field Name



The row ID


The Polyline geometry


The catchment ID the route is in


The from site ID


The to site ID


The direction the route was built (this is only ever Upstream or Downstream)


The length of the polyline

An example of the output of a find nearest downstream site is shown below. Site 5298 links to 5304. The route is highlighted and the length is 2025m.

Nearest Downstream link

The same point layer run through find nearest upstream site generates a different route from 5304 as site 5300 is nearer when travelling in an upstream direction and ignoring route to source.

Nearest upstream link