Downstream Lines

This topic continues from the Watersheds topic.    In hydrology, a watershed is a region of terrain which shares a common drainage.


Given a map that has a raster image layer showing terrain elevations, plus a vector drawing layer that contains points, the downstream lines operation in the Transform pane creates a new drawing that shows the stream line for each point by which water issuing from the point flows further downstream.   


The downstream lines operation creates a new drawing containing lines, representing stream lines, with a Coord field giving the coordinates of the point from which the downstream line flows.  The new drawing inherits the coordinate system of the terrain elevation image.


This topic should be read together with other watershed topics:











Watersheds depend on the data used - The results obtained will depend on the data used.   




With the focus on a map window that contains a raster image as a layer, the Watershed template appears in the Transform pane when a Tile field is picked that in at least one channel that represents the height of terrain at each pixel.   The downstream lines operation requires both an image for terrain elevations and also a drawing for points.  Both the image and the drawing must be in the same map.


Creating a new drawing with downstream lines:


  1. Open an image that represents terrain elevation.

  2. In the Transform pane, choose the image and the Tile field in that image.

  3. Double-click the Watershed template to launch it.

  4. In the Watershed template options, choose the Channel desired.  Single channel images will automatically have channel 0 loaded.

  5. Choose the downstream lines operation for the Output.

  6. In the Start from box, choose the drawing containing points from which upstream areas will be computed.  

  7. The Result is always a new drawing and table.   Specify the names desired.

  8. Press Transform.




Up one level.  Return to the main template list to allow choosing the component or field.  Use this button to choose a different template.

<component name>

Gives the name of the raster image layer in the map that the template is using as a source of terrain elevation data.  If the map has other raster image layers, we can change to any other raster image layer in the same map.


The name of the tile field on which the template operates.   If the raster image has other tile fields providing terrain elevation data, we can choose any other such tile field.


The channel to use for terrain elevation data if the tile field in use has more than one channel.   Raster images typically provide terrain elevation data using tiles that have only one channel, channel 0, where each value is a single number that gives the height of the pixel.  

Water channel

The Water channel parameter allows choosing a channel in the image that provides relative water amounts dropping onto each pixel.  If no water channel is selected, all pixels are assumed to have the same precipitation amounts dropping onto each pixel.


Water channels are used for analyses such as modeling downhill flow of fluids seeping from the surface.   Suppose we have a terrain where some parts of the terrain are seeping oils, and we have a channel that for each pixel shows the amount of oil seeping from that pixel.  Using that channel as a water channel would provide a means of finding watershed lines that represent downhill flow of seeping oil.



Choose the output option to use within this template.  The Transform pane will automatically configure controls to match the output option selected.  Choose downstream lines to run the downstream lines operation.

Start from

Choose a vector drawing layer in the map that contains points for which drainage into those points will be computed.

Start from selection only

Use only selected points in the Start from drawing.  Ignore points that are not selected.

Keep overlaps

Specify how to generate results when the downstream lines for two or more points contain regions that overlap or stream lines in common.  Checking the Keep overlaps box will generate separate downstream lines for both sets of points.  Unchecking the box will collapse overlaps into the stream line of the higher point.


The result for downstream lines is always New Table , creating a new drawing and a new table using the names specified in the New drawing and New table boxes.

Result type

The geometry type to use for the result drawing, Manifold's native geom type, geommfd type, or geomWKB type.  Use the native geom type.

New drawing

The name to use for the new drawing the template will create.

New table

The name to use for the new drawing's table the template will create.


A choice of CPU and GPU parallelization resources the system is allowed to use:


  • all CPU cores - Allow parallelization up to using all CPU cores (threads) with no use of parallel GPU allowed.
  • all CPU cores, all GPU cores -  Allow parallelization up to using all CPU cores (threads) and parallel use of all GPU cores.
  • one CPU core - Allow use of only one CPU core (thread) with no use of parallel GPU allowed.
  • one CPU core, all GPU cores - Allow use of only one CPU core (thread) and parallel use of all GPU cores.


CPU "cores" are used in the Windows meaning of the word core, meaning hyperthread for CPUs that support hyperthreading when hyperthreading is turned on in the BIOS.   Since most modern CPUs and systems support hyperthreading, when Windows reports the number of cores it is really reporting the number of threads.  GPU cores are either used fully parallel for all cores or GPU is not used at all.


The Resources setting puts limits on what the system is allowed to use.  It does not force parallelization if that would result in slower operation.



Apply the transform template.


Show a preview in blue preview color of what the transform operation will do, when possible.   A preview is just a temporary view and does not change anything.


Press the Preview button to launch a preview, or to update a preview after changing any parameters or controls in the pane.  A preview will stay in view until we hide it, or until a layer used to compute the preview is removed or refreshed.  We can add layers, pan and zoom, alt-click objects to view attributes, and edit layers without losing the preview.


Closing a preview:  In map windows, right-click the blue preview caption bar at the top of the window and choose Hide Preview.  In table windows, right-click the blue preview column head and choose Hide Preview.

Edit Query

Launch a Command Window loaded with the SQL query that performs this transform with given settings.


Fields created in the Result drawing:


Manifold identify field.


The geometry of the downstream line.


The flow contributed by the downstream line.


The coordinates of the point for which the downstream line was computed.


This example is based on the same Montara terrain elevation surface featured in the Watersheds topic, but in a version we have created using the Watershed Prepare: Filling Sinks operation.  



To avoid interruptions from sinks, we have first applied the Watershed Prepare: Filling Sinks operation to create an image called Montara filled sinks, which we have styled the same as the original Montara terrain elevation image.


For our convenience, we use the same Samples drawing of four points that is used in other watershed operation examples.   That drawing has points located precisely on watershed stream lines, which is important when finding upstream areas and upstream lines, but does not matter for downstream lines.  When finding downstream lines, the precise location of the point does not matter since all flow from the point continues downstream to the end of the drainage basin in which the point is located.  


With the focus on the map window, in the Transform pane we choose the Montara filled sinks image and we choose the Tile field.   We double-click on the Watershed template to launch it in the Transform pane.



In the Watershed template, we choose channel 0 as the Channel.   Single channel images (as often are used for terrain elevation data) will automatically have channel 0 loaded into the Channel box.


As an Output option we choose the downstream lines operation.  We choose the Samples drawing for the Start from, drawing,  that is, the drawing for end points from which to compute downstream drainage from each point.  We leave the Keep overlaps box unchecked, the default.   


The Result is automatically set to New Table, the only allowed result choice.   We specify Downstream lines for the name of the New drawing to be created by the template.  As we enter the name for the drawing, the pane will automatically fill in an analogous name for the table.   We can change that if we like.


For a preview of what the template will do, press Preview.



Pressing the Preview button shows the previewed results of the operation using blue preview colors along with a blue preview caption bar at the top of the window with the name of the template used for the preview.  Previews are shown on top of all map layers.   To close the preview, right-click on the caption bar and choose Hide Preview.


To apply the transform operation, press Transform.  


A new drawing called Downstream lines appears in the Project pane.   We drag and drop the new Downstream lines drawing into the map as a layer:




The new lines appear in default formatting.   We can Style the Downstream lines layer to make the lines more visible.



We style the  Downstream lines drawing using bright green lines, with a slight black halo on each line to provide better definition of the line.  This shows the stream lines that issue from each point to drain further downstream.



If we open the table for the Downstream lines drawing, we can see that each stream line has a Coord field giving the coordinates of the point from which the downstream line flows.



We can add the Upstream lines drawing that was computed in the Upstream Areas and Lines topic, showing upstream lines calculated for each point using the upstream lines operation, to show how flow from upstream drainage basins flows into each point.


Downstream of each point, there are, of course, other stream lines that are tributaries flowing into each bright green downstream line.     The bright green downstream lines show only the stream line flow that issues from each point, not contributions from other drainages that flow into and join the green lines.



If we would like to see the other downstream tributaries that flow into the green lines, we can add as a layer below the downstream lines the Watershed lines 500 layer calculated in the Watersheds topic using the lines operation.   That layer is slightly imprecise in this context, because it was calculated using a Minimum flow of 500, and not a Minimum flow of 1000 as used for the Upstream lines drawing, and it was also calculated using the original Montara terrain elevation image and not the filled sinks version, Montara Filled Sinks, used to calculate the downstream lines.  But the overall lines layer still provides a useful visual guide to what is going on downstream of the green dots.



Most sinks are small sinks - In real life, undulating terrain is full of small sinks: anywhere that water puddles after a rain is a sink.   Most terrain elevation data with which we work in GIS is too low resolution to capture such small sinks, but there are still plenty of sinks, usually, in data that has been captured at one or two meter resolution, which is common in modern times given the LiDAR revolution in capturing high resolution terrain elevation data.    We can run the Fill Sinks operation with smaller values for Fill height or Fill flow to eliminate smaller sinks while retaining those which are big enough to play a significant role in our watershed analyses.


Sink is slang - The word sink is used casually and imprecisely in the name of the Watershed : sink areas operation.  The operation creates areas that are closed drainage basins, where all rainfall that falls anywhere within the area drains to a common point somewhere within the interior of the area.   Strictly speaking, that common point is the sink.   As a practical matter, sinks are usually not single points but are themselves areas, such as lakes, within the closed drainage basin into which all water drains.    However, sink is such a short, convenient word that it has become popular as a synonym for closed drainage basin.  ESRI calls sinks basins, and other packages may call sinks pits.


Manifold vs Arc - Fifty times Faster than Spatial Analyst -  The first video in a series of comparisons. We compare Manifold Release 9 to ESRI's ArcMap with Spatial Analyst. ArcMap instead of ArcGIS Pro is used to ensure maximum possible speed with no slowdowns from AGOL connections. Starting with a terrain 5300 x 5300 elevation raster we compare Manifold workflow and speed creating streams (watershed lines) with ESRI ArcMap and Spatial Analyst doing the same task. ArcMap requires four operations calculating intermediate steps, taking a total of three minutes and 30 seconds to compute streams.  Manifold does the same job in a single operation in under four seconds, over fifty times faster than Arc, and with the convenience of a single click.  ArcMap plus Spatial Analyst cost over $5000 per seat while Manifold costs under $500.  As data sizes scale up, Manifold gets even faster than Arc. Works in the free Viewer, too!


Manifold vs Arc - Watersheds Sixty Five times Faster than Arc -  Another video comparing Manifold speed to ESRI ArcMap with Spatial Analyst, this time computing upstream watersheds on a 5300 x 5300 terrain elevation raster for a few dozen locations.  ArcMap requires three geoprocessing tool operations calculating intermediate steps, taking a minute and a half.  Manifold does the same job in a single click in less than 1.4 seconds, over 65 times faster than ESRI. The larger and more complex the geoprocessing, the greater Manifold's speed advantage.   ArcMap plus Spatial Analyst cost over $5000 per seat while Manifold costs under $500. Works in the free Viewer, too!


Manifold vs Arc - Seven Seconds vs Four Minutes - Finding basins in a 5300 x 5300 terrain elevation raster, we compare Manifold workflow speed and ease of workflow to ESRI's ArcMap with Spatial Analyst.  ArcMap Standard plus Spatial Analyst costs a total of $5250 so it should work better than a Manifold package that sells for under $500, right?  No way! Manifold absolutely crushes the comparison, taking only a single click and seven seconds to do what takes the $5000+ package three geoprocessing operations and four minutes, not counting the time to setup and launch three operations. Works in the free Viewer, too!


Manifold vs Arc - 100x Faster on an Affordable Desktop - Watch Manifold do in 0.9 seconds what takes ArcMap plus Spatial Analyst over a minute and a half.  That's over 100 times faster!   Some  comments on previous comparisons have stated that Manifold was so super fast compared to ESRI because tests were run on a high-end, Threadripper machine that could run 48 threads. This video shows Manifold is faster even with fewer cores on an affordable desktop system.  We re-run Manifold trials on a  Ryzen 9 3900x computer, with three different tasks taking only 0.9 seconds, 5.4 seconds and 3 seconds.  AMD's 3900x CPU now retails for as low as $450, setting a new baseline for affordable GIS desktop computing.  Everything shown in the video works in the free Viewer, too!


See Also













Style: Thematic Formatting


Transform Pane


Transform Topics


Transform Reference


Transform - Tiles




Upstream Areas and Lines


Watershed Prepare: Filling Sinks


Flow Direction and Accumulation