| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Python script for automating catchment delineation in QGIS from a raster layer using WhiteboxTools. The script fills depressions, generates isobasins, and vectorizes them for integration into geospatial workflows.
Before running the script, you need to install WhiteboxTools. Open your Command Line Interface (CLI) and run the following command: pip install whitebox
try: from whitebox.whitebox_tools import WhiteboxTools print("WhiteboxTools imported successfully.") except ImportError as e: print(f"Error importing WhiteboxTools: {e}") print("Make sure you have installed the whitebox package using pip.")
Running the Script 1.Open QGIS. 2.Load your DEM file into QGIS or ensure you have the path to the DEM file you want to process. 3.Open the Python Console in QGIS (Plugins > Python Console). 4.Copy and paste the script into the console or use a .py file that contains the script.
Script Overview The script performs the following steps:
Fill Depressions: Takes the input DEM and fills depressions using the Wang and Liu method. Outputs a raster layer with filled depressions.
Generate Isobasins: Creates isobasins based on the filled DEM. The target basin size can be specified by the user.
Vectorize Isobasins: Converts the isobasins raster into vector polygons. The resulting vector layer is then loaded into QGIS for further analysis.
Example Usage**** Below is an example of how to use the script in the QGIS Python console. Specifiy input DEM path accurately. Specify output result layer path accurately as desired.
input_dem_path = 'C:/path/to/your/DEM.tif' filled_sinks_path = 'C:/path/to/output/filled_sinks.tif' isobasins_path = 'C:/path/to/output/isobasins.tif' vectorized_isobasins_path = 'C:/path/to/output/vectorized_isobasins.shp'
Run the script (details are provided in the main script file)
| Back | FazBrowse Home | New Git URL |