Netshape2Flow

Rasterizes a river network drawn as lines into the drainage directions of its cells, on the grid of a given raster. It brings a known network, digitized from maps or surveys, into the raster modules: the flow map can force the drainage directions of DrainDir along the real channels, where the elevation model alone would route the water elsewhere, as on flat valley floors or across embankments.

Besides the flow map, it writes the rasterized network, with the id of each reach, and the points where the lines need to be corrected.

Details

The network lines must be drawn from upstream to downstream: the order of their vertices gives the flow direction. The cells of a reach get the D8 direction to the next cell, its last cell the outlet value 10, unless another reach already passes there, as at a confluence. The flow map can be used to force the drainage directions along a known network, as the network flow input of DrainDir.

The reach id comes from the id field or, without it, from the feature id. With the active field, the reaches whose value starts with n (as no) are skipped, empty values count as active.

The cells where a reach runs into another one already rasterized, before its last segment, are written to the problem points, to correct the network lines.

Parameters

Transforms the network shape to a flow map.

Toolbox folder: Network
Status: Experimental
Keywords: Network, Flowdirections
Authors: Silvia Franceschi, Andrea Antonello
Class: org.hortonmachine.modules.Netshape2Flow

Inputs

Parameter

Type

Unit

Default

Description

inNet

vector file

The network features.

inGrid

raster file

A raster whose grid, extent and resolution, is used for the output maps, for example the elevation model.

fActive

String

The field of the attributes table of the network flagging the feature as active.

fId

String

The field of the attributes table of the network defining the id of the feature.

Outputs

Parameter

Type

Unit

Description

outFlownet

output file

The output flow map on the network pixels.

outNet

output file

The output network map.

outProblems

output file

The problems features points.

Example

The example runs on the sample elevation model of the manual, dtm_flanginec.tif in docs/manual/modules/maps/data, each module on the outputs of the previous ones. Here the network of NetworkAttributesBuilder, extracted from the same elevation model, stands in for a digitized one:

import org.hortonmachine.modules.Netshape2Flow

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

var netshape2Flow = new Netshape2Flow()
// the network lines of NetworkAttributesBuilder, drawn from upstream to downstream
netshape2Flow.inNet = folder + "net_attributes.shp"
// the grid of the output maps
netshape2Flow.inGrid = folder + "pit.tif"
netshape2Flow.outFlownet = folder + "flownet.tif"
netshape2Flow.outNet = folder + "netshape.tif"
netshape2Flow.outProblems = folder + "netshape_problems.shp"
netshape2Flow.process()
The drainage directions of the network lines of NetworkAttributesBuilder, rasterized on the grid of the elevation model.

The drainage directions of the network lines of NetworkAttributesBuilder, rasterized on the grid of the elevation model.