Delete small lakes and extend rivers

This tool can be used to remove small lakes (polygons) in a vector drainage network and to extend the associated river network (intersecting polylines) into the interior of the lake. The user must specify the names of the input and output lakes (polygon) and streams (polyline) shapefiles, as well as the lakes area threshold. The tool is similar to the Delete Polygons and Extend Lines tool in ArcGIS's Production Mapping toolset. The tool differs from the ArcGIS tool in that it does not modify the input polygon (lakes) and polyline (rivers) shapefiles, but rather outputs separate shapefiles for each; storage is cheap and there is no undo button once you've modified a shapefile! It also uses a distance threshold, such that it will identify an inlet/outlet as a river segment starting/ending node that is within the specified distance to a lake polygon. That way, if the rivers do not perfectly connect with the lakes, a solution can still be found. Stream segments are extended to a central, and always interior, point within the lake.

Delete small lakes

See Also:

Scripting:

The following is an example of a Python script that uses this tool:

wd = pluginHost.getWorkingDirectory()
lakesFileIn = wd + "inLakes.shp"
streamsFileIn = wd + "inStreams.shp"
lakesFileOut = wd + "outLakes.shp"
streamsFileOut = wd + "outStreams.shp"
areaThreshold = "100.0"
distThreshold = "50.0"
args = [lakesFileIn, streamsFileIn, lakesFileOut, streamsFileOut, areaThreshold, distThreshold]
pluginHost.runPlugin("DeleteSmallLakesAndExtendRivers", args, False)

This is a Groovy script also using this tool:

def wd = pluginHost.getWorkingDirectory()
def lakesFileIn = wd + "inLakes.shp"
def streamsFileIn = wd + "inStreams.shp"
def lakesFileOut = wd + "outLakes.shp"
def streamsFileOut = wd + "outStreams.shp"
def areaThreshold = "100.0"
def distThreshold = "50.0"
String[] args = [lakesFileIn, streamsFileIn, lakesFileOut, streamsFileOut, areaThreshold, distThreshold]
pluginHost.runPlugin("DeleteSmallLakesAndExtendRivers", args, false)

Credits: