Upstream Areas and Lines

This topic continues from the Watersheds topic.  

 

Given a map that has a raster image layer showing terrain elevations, plus a vector drawing layer that contains points, the Watershed : upstream areas and Watershed : upstream lines operations in the Transform pane create a new drawing that shows the regions that drain into each point (upstream areas), or the stream lines that flow into each point.   The new drawing inherits the coordinate system of the terrain elevation image, with useful attribute field provided as well.

 

Upstream areas and upstream lines computations usually only make sense for points that are located on a watershed stream line. See the Watersheds topic for a discussion of watershed stream lines.

 

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, upstream areas, and upstream lines operations require 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 upstream 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 upstream lines operation for the Output.

  6. Specify the Minimum flow required to create a stream line. Smaller Minimum flow values will result in many more, smaller areas or streams. Larger Minimum flow values will result in fewer, larger areas or streams.

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

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

  9. Press Transform.

 

Controls

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.

Field

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.

Channel

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.

 

Output

Choose the output option to use within this template.  The Transform pane will automatically configure controls to match the output option selected.     Choose upstream areas or upstream lines to run those operations.

Minimum flow

Appears for the upstream lines operation.  The minimum total flow in the basin required to create a stream line.  Smaller Minimum flow values will result in many more, smaller areas or streams. Larger Minimum flow values will result in fewer, larger areas or streams.  The Minimum flow parameter is not used for upstream areas.

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 upstream areas or lines for two or more points contain regions that overlap or stream lines in common.  Checking the Keep overlaps box will generate separate upstream areas and lines for both sets of points.  Unchecking the box will collapse overlaps into the area or stream line of the higher point.

Result

The result for upstream areas or upstream 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.

Resources

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.

 

Transform

Apply the transform template.

Preview

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:

mfd_id

Manifold identify field.

Geom

The geometry of the upstream area or line.

Value

The flow contributed by the upstream area or line.

Coord

The coordinates of the point for which the upstream area or line was computed.

 

We can see the fields that are created by opening a typical schema for a table of watershed areas:

 

 

The Coord value is a float64x2 data type.

Example: Create Upstream Areas

Given a raster image showing terrain elevations, plus a drawing that contains points, we can use the upstream areas operation to find the regions from which water flows to each point.   The terrain image and drawing must be layers in the same map.

 

This example is based on the same Montara terrain elevation surface featured in the Watersheds topic.

 

 

Consider our Montara terrain as seen above, with a drawing called Samples that contains four points, indicated by green dots.

 

 

Upstream areas and upstream lines computations usually only make sense for points that are located on a watershed stream line.   Therefore, to ensure illustrations provide clear and easily-understood results, we have positioned each point exactly on a watershed line, as can be seen in the illustration above, which adds a layer of watershed stream lines.   

 

To create points exactly on a watershed stream line, we used the Watershed lines 500 layer calculated in the Watersheds topic using the Watershed : lines operation.  

 

We created the points by first clicking the Watershed lines 500 layer to make that the active layer, and then we zoomed in to candidate locations and created points, taking advantage of Snap to coordinates  to create each point exactly at one of the vertices that define a line.   We then selected the points, Cut them out of the Watershed lines 500 drawing and Pasted them into the Samples drawing.  In a "real life" scenario, we might have taken water samples from a stream, we may have detected an unusual substance in the sample, and we might want to know what drainage basin drained into that location within a stream so we could look for the source of the detected substance.

 

With the focus on the map window, in the Transform pane we choose the Montara 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 upstream areas operation.   We choose the Samples drawing for the Start from, that is, the end points from which to compute upstream drainage.  We leave the Keep overlaps box unchecked, the default.   

 

The Result is automatically set to New Table, the only allowed result choice.   We specify Upstream areas for the name of the New drawing to be created by the template, with an analogous name for the New table.  

 

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 Upstream areas  appears in the Project pane.   We drag and drop the new Upstream areas drawing into the map as a layer:

 

 

The resulting areas appear in default formatting.   We can use the Style pane to provide a more informative display.

 

 

To add better context, we add the Watershed lines 500 drawing to the map to show stream lines flowing through the terrain.  We style new Upstream areas drawing so the areas are green, and use a thicker border line.   We use the Layers pane to set 50% opacity for the Upstream areas layer, so the background and streams layers shows through.    Each of the green areas shows the drainage basin, the watershed, that drains through the associated green point.

 

 

For each upstream area created, the table reports the total flow from that area to the point, as well as providing a Coord value that gives the location of the point in whatever is the coordinate system used.  In this case, the Montara image is in Universal Transverse Mercator coordinates, so that is how the point locations are reported, in projected coordinate system values.

Keep Overlaps Option

Two or more points may share the same upstream area or line.  

 

 

Consider a set of sample points like the set used in the prior example, but with an additional point, marked with a magenta arrow, added on the Western side of the view, placed exactly on an upstream line and within the drainage basin of one of the prior points.

 

 

We choose the upstream areas operation, with the Keep overlaps box unchecked, the default setting.   For the new drawing we use the name Upstream areas no overlaps.

 

Press Transform.

 

 

The new Upstream areas no overlaps drawing contains an additional upstream area that was computed for the additional point.  

 

 

We style  the new Upstream areas no overlaps drawing and applied partial transparency to the layer.    However, it may not be clear that the blue area and the red area do not overlap.

 

We can use two different ways of formatting areas with Style, to better show the lack of overlaps.

 

 

One way is to draw areas with transparent fill color, and to using varying styles for the area border.  In the illustration above, all areas have borders that are colored differently for different areas. In some locations, the overlapping borders cover each other.   In addition, the red area has an inner border drawn that is alternating red and white dashes.   That shows there are no overlaps between the red and blue areas.  To create the above illustration, we have used a black base background for the map and have then used the Layers pane o set 80% opacity for the Montara image layer, which has the effect of darkening the Montara layer, so the lines used for borders better stand out.

 

 

Another way to show any overlaps is to use a hatched area style, with hatch patterns rotated differently for each area.   In the illustration above, we can see there are no overlaps between the red area and the blue area.

 

 

We now repeat the operation, but this time checking the Keep overlaps box.

 

 

The result, seen using our border outline style of formatting, shows that the blue area and the red area overlap.  

 

 

Likewise, we can see the overlap if we use the other way of styling areas, using hatch patterns.    

 

Whether or not Keep overlaps is checked depends on how we want to show upstream areas in cases where some points in the sample set fall within the upstream areas of other points in the sample set.

Create Upstream Lines

Given a raster image showing terrain elevations, plus a drawing that contains points, we can use the upstream lines operation to find the stream lines by which water flows to each point.  The terrain image and drawing must be layers in the same map. The process is similar to using the upstream areas operation, except that with lines we must also specify the minimum flow.

 

This example also is based on the same Montara terrain elevation surface featured in the Watersheds topic.

 

 

We start with the same Montara terrain as used in the prior example, again using a drawing called Samples that contains four points, indicated by green dots., each of which has been placed on a stream line.

 

With the focus on the map window, in the Transform pane we choose the Montara 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 upstream lines operation.   We enter 1000 for Minimum flow.  We choose the Samples drawing for the Start from, that is, the end points from which to compute upstream drainage.  We leave the Keep overlaps box unchecked, the default.   

 

The Result is automatically set to New Table, the only allowed result choice.   We specify Upstream lines for the name of the New drawing to be created by the template, with an analogous name for the New table.  

 

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 Upstream lines appears in the Project pane.   We drag and drop the new Upstream lines drawing into the map as a layer:

 

 

The new drawing appears using default formatting for the upstream lines.  We can make them more visible by using the Style pane.

 

 

We style the new Upstream lines drawing using yellow lines, with a slight black halo on each line to provide better definition of the line.  This shows the stream lines that drain into each point.  

 

 

To provide additional visual context, we can add the Upstream areas layer to show the areas drained by each set of upstream lines.  For example, a large, upstream area drains into, and through, the most Western point.

Lines and Keep Overlaps

The Keep overlaps option works for upstream lines as well as for upstream areas.

 

 

We use the same Samples 2 drawing used in the Keep overlaps examples for upstream areas.    All points in the drawing have been positioned on stream lines.

 

 

We choose the Samples 2 drawing for the Start from drawing, and we check the Keep overlaps box.

 

 

The resulting drawing shows the two sets of upstream lines from the two points near the left edge of the view.   The drawing has been styled so all sets of upstream lines have different colors.  If the point with blue upstream lines were not in the drawing, the red upstream lines would extend upstream where the blue lines are located in the illustration above.   If we had checked the Keep overlaps box, in addition to the blue upstream lines the red upstream line network would extend upstream to where the blue lines are located, with both red and blue lines in that region.

Create Upstream Areas with SQL

Templates are very easy to use given their point-and-click interface, but SQL functions which power those operations are also easy to use.    Given a drawing that contains points, we can write a query that uses the TileWatershedAreasUpstreamPar function to find the areas from which water flows to each point.  To create upstream lines, the TileWatershedLinesUpstreamPar function finds all stream lines which flow into each point.   

 

 

Consider our Montara terrain as seen above, with a drawing called Samples that contains four points, indicated by green dots.

 

 

Upstream areas and upstream lines computations usually only make sense for points that are located on a watershed stream line.   Therefore, to ensure illustrations provide clear and easily-understood results, we have positioned each point on a watershed line, as can be seen in the illustration above, which adds a layer of watershed stream lines.  

 

 

The easiest way to learn how to write queries is to set up the Transform pane with the template and operation we want along with all desired parameters, and to then press the Edit Query button to see what SQL Manifold writes to accomplish the task.

 

In the illustration above, we have set up a typical upstream areas operation.   When we press the Edit Query button, Manifold pops open a Command Window that is loaded with the SQL query that accomplishes the transform with all options as specified:

 

 

No need to panic, as most of the query is routine setup, with the query structured so we can re-run only part of it after making any modifications we desire.   The operational part of the query boils down to only two key lines.

 

The full query is:

 

-- $manifold$

--

-- Auto-generated

--

-- Watershed

--   Layer: Montara

--   Field: Tile

--   Channel: channel 0

--   Water channel: (none)

--   Output: upstream areas

--   Start from: Samples

--   Start from selection only: FALSE

--   Keep overlaps: FALSE

--   Result: (new table)

--   Result type: geom

--   New drawing: SQL upstream areas

--   New table: SQL upstream areas Table

--   Resources: all CPU cores, all GPU cores

--

 

-- prepare begin

 

CREATE TABLE [SQL upstream areas Table] (

  [mfd_id] INT64,

  [Value] FLOAT64,

  [Coord] FLOAT64X2,

  [Geom] GEOM,

  INDEX [mfd_id_x] BTREE ([mfd_id]),

  INDEX [Geom_x] RTREE ([Geom]),

  PROPERTY 'FieldCoordSystem.Geom' ComponentFieldCoordSystem([Montara Table], 'Tile')

);

CREATE DRAWING [SQL upstream areas] (

  PROPERTY 'Table' '[SQL upstream areas Table]',

  PROPERTY 'FieldGeom' 'Geom'

);

 

-- prepare end

 

VALUE @drawing TABLE = [Samples];

VALUE @image TABLE = CALL ComponentFieldImage([Montara Table], 'Tile');

VALUE @watershed TABLE = CALL TileWatershedMakePar(@image, 0, -1, ThreadConfig(SystemCpuCount()));

 

DELETE FROM [SQL upstream areas Table];

INSERT INTO [SQL upstream areas Table] (

  [Value], [Coord],

  [Geom]

) SELECT

  [Value], [Coord],

  [Geom]

FROM CALL TileWatershedAreasUpstreamPar(@watershed, @drawing, FALSE, ThreadConfig(SystemCpuCount()));

 

 

There are four parts to the query, which we can unpack as follows:

Comments

-- $manifold$

--

-- Auto-generated

--

-- Watershed

--   Layer: Montara

--   Field: Tile

--   Channel: channel 0

--   Water channel: (none)

--   Output: upstream areas

--   Start from: Samples

--   Start from selection only: FALSE

--   Keep overlaps: FALSE

--   Result: (new table)

--   Result type: geom

--   New drawing: SQL upstream areas

--   New table: SQL upstream areas Table

--   Resources: all CPU cores, all GPU cores

 

The comments, beginning with two dash -- characters, provide a report of what options were used when generating the query.

Create a Table and a Drawing

-- prepare begin

 

CREATE TABLE [SQL upstream areas Table] (

  [mfd_id] INT64,

  [Value] FLOAT64,

  [Coord] FLOAT64X2,

  [Geom] GEOM,

  INDEX [mfd_id_x] BTREE ([mfd_id]),

  INDEX [Geom_x] RTREE ([Geom]),

  PROPERTY 'FieldCoordSystem.Geom' ComponentFieldCoordSystem([Montara Table], 'Tile')

);

CREATE DRAWING [SQL upstream areas] (

  PROPERTY 'Table' '[SQL upstream areas Table]',

  PROPERTY 'FieldGeom' 'Geom'

);

 

-- prepare end

 

The next section creates a table and a drawing.   The ComponentFieldCoordSystem function is used to create the table using the same coordinate system used by the source Montara layer.

Declare Global Values

VALUE @drawing TABLE = [Samples];

VALUE @image TABLE = CALL ComponentFieldImage([Montara Table], 'Tile');

VALUE @watershed TABLE = CALL TileWatershedMakePar(@image, 0, -1, ThreadConfig(SystemCpuCount()));

 

Using global values can keep things simpler and clearer.  Global values also allow us to modify the query by making a change in just one place, for example, changing the name of the drawing that is used to provide point locations.    The first VALUE declaration gives the name of the drawing for points, and then second VALUE declaration gives the name of the image, specifying the table and tile field, that is the source of the terrain elevation raster.

 

The third VALUE declaration creates a watershed object using the TileWatershedMakePar function.   A watershed object is a table, so we use CALL to call the function and we declare the @watershed global value to be a TABLE.   Reducing the long text for the function name and thread configuration argument to a single @watershed global value helps improve legibility of the query and keeps it from getting too intimidating and hard to follow.  

Compute Upstream Areas and Populate the Table

DELETE FROM [SQL upstream areas Table];

INSERT INTO [SQL upstream areas Table] (

  [Value], [Coord],

  [Geom]

) SELECT

  [Value], [Coord],

  [Geom]

FROM CALL TileWatershedAreasUpstreamPar(@watershed, @drawing, FALSE, ThreadConfig(SystemCpuCount()));

 

The final part of the query first deletes anything in the SQL upstream areas Table.  It does that even though the first time the query is run there is nothing in that table.  But doing that allows us to run the entire query once, see what it does, and then we can modify the global values and rerun only the global values and last part of the query without having to first delete the table and drawing that were created so the query can create them again.  

 

The operational part of the query is just a single call to the TileWatershedAreasUpstreamPar function, using global values as arguments.

Why make a watershed object and then use it?

To create geometry for objects, such as upstream areas, for watersheds we use a two-step approach.  We first create a watersheds object, and then we pass that watersheds object to a function that creates the desired geometry, such as upstream areas, watershed areas, watershed lines and so on.    

 

Manifold uses the two step approach because we often want to computed different geometries, such as areas or lines, from the same watershed.  But watersheds are costly to compute:  if we want three different geometries it would be wasteful to compute the same watershed three times, once within each function.   Using TileWatershedMake we can compute the watersheds object just once and then reuse that same watersheds object however many times we want to compute various different geometries of interest.   

 

In this example, we compute only one geometry, that of upstream areas, but if we had wanted also to compute watershed areas and watershed lines, or downstream lines, we could have added those to the query and simply used the same @watersheds object that was computed just once in the beginning.   With virtually no additional time required we could have gotten three additional geometries, since most of the computation is in the original figuring of the watersheds object.

 

There is also a reduction in the number of different functions required.   Watersheds can be computed either from images that have a height in each pixel, or from images that have a direction in each pixel.   Instead of having two different forms of each geometry function (one using heights and one using directions), we can have just one form of each geometry function that takes a watershed object.

 

We can then compartmentalize the creation of watershed objects into two different Make functions, one which creates watershed objects from heights, TileWatershedMake, and the other which creates watershed objects from directions, TileWatershedMakeDir.     In this case, we computed the watershed object from an image, the Montara image, that gives heights.   But if we were working with an image that gave flow directions, we could have used exactly the same query except for changing the name of the function used to get the @watersheds global value.

 

Compartmentalizing the computation of watersheds from the use of such watersheds to get various different geometries greatly reduces the number of different functions, while retaining the flexibility of creating whatever geometry is desired from watersheds that are created either from heights or from directions.

Running the Query

Press the ! Run command button in the main toolbar to run the query.   It creates a table called SQL upstream areas Table, a drawing called SQL upstream areas, and it populates the table with upstream line objects.

 

 

We drag and drop the new SQL upstream areas drawing into our map, and style it using a magenta fill color for areas. We use the Layers pane to set 50% opacity for the layer, so the background shows through.  

Create Upstream Lines with SQL

We can repeat the above process with a slightly modified query that uses the TileWatershedLinesUpstreamPar function to create upstream drainage lines that drain into each point.

 

 

In the Transform pane we choose the upstream lines operation, specify 1000 for Minimum flow, and then provide SQL upstream lines as the name of the drawing and an analogous name for the table.   When we press the Edit Query button, Manifold pops open a Command Window that is loaded with the SQL query that accomplishes the transform with all options as specified:

 

The query text is:

 

-- $manifold$

--

-- Auto-generated

--

-- Watershed

--   Layer: Montara

--   Field: Tile

--   Channel: channel 0

--   Water channel: (none)

--   Output: upstream lines

--   Minimum flow: 1000

--   Start from: Samples

--   Start from selection only: FALSE

--   Keep overlaps: FALSE

--   Result: (new table)

--   Result type: geom

--   New drawing: SQL upstream lines

--   New table: SQL upstream lines Table

--   Resources: all CPU cores, all GPU cores

--

-- prepare begin

CREATE TABLE [SQL upstream lines Table] (

  [mfd_id] INT64,

  [Value] FLOAT64,

  [Coord] FLOAT64X2,

  [Geom] GEOM,

  INDEX [mfd_id_x] BTREE ([mfd_id]),

  INDEX [Geom_x] RTREE ([Geom]),

  PROPERTY 'FieldCoordSystem.Geom' ComponentFieldCoordSystem([Montara Table], 'Tile')

);

CREATE DRAWING [SQL upstream lines] (

  PROPERTY 'Table' '[SQL upstream lines Table]',

  PROPERTY 'FieldGeom' 'Geom'

);

-- prepare end

VALUE @drawing TABLE = [Samples];

VALUE @image TABLE = CALL ComponentFieldImage([Montara Table], 'Tile');

VALUE @watershed TABLE = CALL TileWatershedMakePar(@image, 0, -1, ThreadConfig(SystemCpuCount()));

DELETE FROM [SQL upstream lines Table];

INSERT INTO [SQL upstream lines Table] (

  [Value], [Coord],

  [Geom]

) SELECT

  [Value], [Coord],

  [Geom]

FROM CALL TileWatershedLinesUpstreamPar(@watershed, @drawing, 1000, FALSE, ThreadConfig(SystemCpuCount()));

 

Setting aside the slightly different names used for the new drawing and table, the query is almost identical to the areas query, except that the TileWatershedLinesUpstreamPar function takes an additional argument that specifies minimum flow.  We use 1000 for the minimum flow.

 

We ! run the query and it creates a new drawing and the drawing's table.

 

 

Dragging and dropping the drawing into our map, we Style it using magenta lines, with a slight black halo on each line to provide better definition of the line.  This shows the stream lines that drain into each point.

Locate Points on Streams for Upstream Calculations

Why should points be located on watershed streams when using upstream areas or upstream lines functions?  If a point is not on a stream line, the area that drains through that point will be small, often so small the area might not even be big enough to see without zooming far into the view.

 

Consider a point located in the mighty Danube river, near the mouth of the river where it flows into the Black Sea.   Water falling on parts of nineteen countries in Europe, a vast area, drains through that point.  Consider, in contrast, a point located on the side of a small hill overlooking the Danube near the mouth of the river.  Only water which falls on that small hill, on the side above the point, drains through that point.   We can see the effect using our Montara terrain.

 

 

In the illustration above, we have zoomed into the most Western, green point in the Samples drawing layer.  We have also turned on the watershed lines layer to show how the point is located on a main watershed line.   

 

Water falling onto any location in the green upstream area will flow downhill and eventually flow through that green point.  The yellow upstream lines show how water falling onto the green upstream area will gather together into streams at the bottom of valleys, which in turn merge as tributaries into the main stream leading through the green point.   Water falling outside the green upstream area will not flow through the green point.  Instead, that water will flow into watershed streams downhill from the green point.  

 

In the illustration above we have added a drawing layer called Hill Dot that contains a single, magenta point located on a low hill near the green Samples point.

 

 

Turning off some layers for a clearer view, we can see how the magenta dot is slightly above what seem to be the main channels of drainage through the terrain.

 

 

We set up the Transform pane to compute upstream areas using the Hill Dot drawing as the Start from drawing.   That will find the regions from which water drains into the point in the Hill Dot drawing.    Press Transform and a new Hill Dot upstream area drawing appears in the Project pane.

 

We drag and drop the new Hill Dot upstream area drawing into the map.

 

 

At first glance, it appears the operation failed to create any upstream area for the Hill Dot point.   Only a very slight, almost imperceptable bump on the upper-right portion of the magenta dot indicates any difference.   We zoom further into the drawing to take a closer look.

 

 

Zoomed far in, we see that the magenta dot is located near the top of a small hill.  The only region upstream of the dot is a tiny area, shown in red color, that appears to be only a few pixels in size.    In contrast, we can see from the upstream lines layer for the green dot, that the green dot is downstream of a vastly larger drainage area.    This is a classic example of the difference in upstream area for a point located within a major river, like the Nile or the Danube, and a point located nearby on top of a small hill near the river.  The Danube drains much of Europe, while a point on a small hill near the Danube drains only part of that small hill.

 

 If points are randomly located on a terrain, the upstream drainage areas and stream lines for each point are likely to be very small, often so small that it may seem the upstream functions have created no upstream areas or lines.   In contrast, locating a point on a watershed stream ensures that some reasonable size of upstream area or upstream lines will be generated.

 

That also reflects the practical use for such computations, which is to ascertain the source of materials detected when analyzing water samples taken from rivers or streams.  For example, if we find contamination from a toxic material in a water sample taken from a stream or a river, we can see the upstream catchment basin from which it might have come.   We can generate upstream lines to guide the collection of additional samples from tributary streams to zero in on the source of the contamination.

Notes

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 Watershed Prepare transform template 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.

Videos

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

Tables

 

Maps

 

Drawings

 

Images

 

Labels

 

Style

 

Style: Thematic Formatting

 

Transform

 

Transform Pane

 

Transform Reference

 

Transform - Tiles

 

Watersheds

 

Example:  Create Watershed Areas

 

Example: Create Watershed Lines

 

Shreve Order and Strahler Order

 

Watershed Areas, Sinks

 

Watershed Prepare: Filling Sinks

 

Downstream Lines

 

Flow Direction and Accumulation