ShinyFPZ is an interactive R Shiny application for exploring and classifying Functional Process Zones (FPZs) from river network datasets using hydrogeomorphic variables obtained from the OpenRES QGIS plugin. The app provides a streamlined workflow for clustering river segments, visualizing results, and exporting both analytical and spatial outputs.
Functional Process Zones (FPZs) represent distinct hydrogeomorphic segments of river networks defined by combinations of environmental variables such as elevation, valley width, sinuosity, and geological context. ShinyFPZ enables users to:
- Upload a spatial dataset (zipped shapefile)
- Select hydrogeomorphic variables for clustering
- Perform FPZ classification using hierarchical clustering
- Explore clustering diagnostics
- Visualize FPZ results on an interactive map
- Export figures, tables, and spatial outputs
The app is designed for rapid exploratory analysis and communication of FPZ classifications.
- Hierarchical clustering using Ward.D2
- Gower distance to support mixed numeric and categorical variables
- Two clustering workflows:
- Silhouette-based selection of cluster number
- Tree height cutoff
ShinyFPZ generates several diagnostic plots:
- Silhouette plot
- Hierarchical dendrogram
- PCA biplot showing relationships among hydrogeomorphic variables
- Interactive Leaflet map displaying FPZ classifications
The Leaflet map allows users to:
- View FPZ classes spatially
- Explore results for point or line datasets
- Inspect map diagnostics including feature counts and geometry types
Users can export:
- Silhouette plot (.png)
- Dendrogram (.png)
- PCA biplot (.png)
- Silhouette table (.csv)
- Cluster summary (.csv)
- Spatial output (.gpkg)
ShinyFPZ expects a zipped shapefile containing:
- .shp
- .shx
- .dbf
- .prj
The dataset should contain hydrogeomorphic attributes used for FPZ classification generated by the OpenRES QGIS plugin. Example variables often used include:
| Variable | Description |
|---|---|
| ELE | Elevation |
| PRE | Precipitation |
| GEO | Geological category |
| VW | Valley width |
| VFW | Valley floor width |
| RAT | Valley width ratio |
| SIN | Channel sinuosity |
| RVS/LVS/DVS | Valley slope metrics |
Both point and line geometries are supported.
- Upload a zipped shapefile
- Select hydrogeomorphic variables
- Specify clustering options
- Run FPZ classification
- Inspect diagnostics:
- silhouette curve
- dendrogram
- PCA biplot
- Explore FPZ spatial patterns on the interactive map
- Export results
Clone the repository:
git clone https://github.com/yourusername/ShinyFPZ.git
Install required R packages:
install.packages(c(
"shiny",
"sf",
"dplyr",
"cluster",
"ggplot2",
"FactoMineR",
"RColorBrewer",
"DT",
"tidyr",
"leaflet"
))
Run the app:
shiny::runApp("ShinyFPZ")
ShinyFPZ is useful for:
- River network classification
- Exploratory hydrogeomorphic analysis
- Environmental stratification of watersheds
- Supporting biodiversity and habitat studies
- FPZ mapping for restoration planning
ShinyFPZ is under active development. Planned improvements include:
- Additional clustering methods
- Expanded map styling options
- Improved FPZ diagnostic tools
