kartverket / automatisk-generalisering

MIT License
0 stars 2 forks source link

Add scripts for river direction and strahler calculation #182

Closed johlys closed 3 months ago

johlys commented 3 months ago

Added scripts for correcting the direction of all river segments and for calculating the strahler value for all river segments.

Main scripts

process_river_basins_direction.py

This script processes river segments within specified drainage basins, calculates height values, and identifies segments that need to be flipped to ensure correct flow direction. The final output is a merged shapefile containing flipped river segments if necessary.

strahler_hierarchy.py

This script calculates Strahler values for river segments using a directed graph approach. It processes river data either from a shapefile or from feature classes in a geodatabase, and outputs the Strahler values for each river segment.

Development scripts

build_river_network.py

Script to build the network of rivers that can be traversed. Uses height data.

config_template.py

Setup for the paths used in the scripts. Copy the contents of this file into a new file named config.py and update the paths as needed.

count_cycles.py

Counts the cycles in the network.

join_river_and_drainage_basin.py

Joins river and drainage basin data, selecting rivers within a specified basin and saving the results to a new shapefile.

join_river_and_height_data.py

Extracts height data for river points, reconstructs 3D river lines, and saves the new 3D lines to a shapefile.

visualize_cycles.py

Visualizes the cycles in the network.

closes #181. closes #73.