https://github.com/brownag/rgeomorphon
A lightweight implementation of the geomorphon terrain form classification algorithm of Jasiewicz and Stepinski (2013)
https://github.com/brownag/rgeomorphon
classification cpp elevation geomorphometry geomorphon r terrain
Last synced: about 21 hours ago
JSON representation
A lightweight implementation of the geomorphon terrain form classification algorithm of Jasiewicz and Stepinski (2013)
- Host: GitHub
- URL: https://github.com/brownag/rgeomorphon
- Owner: brownag
- License: gpl-3.0
- Created: 2025-05-31T17:29:48.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2026-03-26T05:29:26.000Z (about 1 month ago)
- Last Synced: 2026-03-26T18:33:13.084Z (about 1 month ago)
- Topics: classification, cpp, elevation, geomorphometry, geomorphon, r, terrain
- Language: R
- Homepage: http://humus.rocks/rgeomorphon/
- Size: 2.54 MB
- Stars: 27
- Watchers: 0
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rgeomorphon
[](https://CRAN.R-project.org/package=rgeomorphon)
[](https://cran.r-project.org/web/checks/check_results_rgeomorphon.html)
[](https://brownag.r-universe.dev/)
[](https://github.com/brownag/rgeomorphon/actions)
[](https://humus.rocks/rgeomorphon/)
A lightweight implementation of the geomorphon terrain form classification
algorithm of [Jasiewicz and Stepinski (2013)](https://doi.org/10.1016/j.geomorph.2012.11.005)
based largely on the GRASS GIS [r.geomorphon](https://grass.osgeo.org/grass-stable/manuals/r.geomorphon.html)
module.
This implementation employs a novel algorithm written in C++ and {RcppParallel}.
For the sake of simplicity, some GRASS-specific implementation details have not
been added. See `?geomorphons` for details.
## Installation
You can install {rgeomorphon} from CRAN:
``` r
install.packages("rgeomorphon")
```
And you can install the development version from GitHub:
``` r
# install.packages("remotes")
remotes::install_github("brownag/rgeomorphon")
```
## Volcano Example
This is a basic example using the classic R `volcano` dataset and {terra}
SpatRaster object as input.
`volcano` is a 10m by 10m grid of elevation values from Maunga Whau in the
Auckland volcanic field of New Zealand.
```{r volcano}
library(terra)
library(rgeomorphon)
# PARAMETERS
SEARCH = 7 # outer search radius (cells)
SKIP = 0 # inner skip radius (cells)
FLAT = 1 # flat angle threshold (degrees)
## classic volcano elevation data
data("volcano", package = "datasets")
# construct and georeference a SpatRaster object
dem <- terra::flip(terra::rast(volcano))
terra::crs(dem) <- terra::crs("EPSG:27200")
terra::ext(dem) <- c(2667400, 2668010, 6478700, 6479570)
names(dem) <- "Elevation (meters)"
# calculate geomorphons "forms"
system.time({
rg <- geomorphons(
dem,
search = SEARCH,
skip = SKIP,
flat = FLAT
)
})
# inspect result
plot(c(dem, rg),
plg = list(x = "bottomleft",
bty = "o",
bg = "white"))
```
## Salton Sea Example
Now we will do a bathymetry example using the built in Salton Sea dataset (`salton`).
See `help("salton")` for details.
```{r salton}
library(terra)
library(rgeomorphon)
# PARAMETERS
SEARCH = 10 # outer search radius (cells)
SKIP = 3 # inner skip radius (cells)
FLAT = 0.1 # flat angle threshold (degrees)
# salton sea bathymetry sample data
data("salton", package = "rgeomorphon")
# construct and georeference a SpatRaster object
dem <- terra::rast(salton)
terra::crs(dem) <- attr(salton, "crs")
terra::ext(dem) <- attr(salton, "extent")
names(dem) <- "Elevation (feet)"
# calculate bathymorphons using 6-form system
system.time({
rg <- geomorphons(
dem,
search = SEARCH,
skip = SKIP,
flat = FLAT,
forms = "forms6"
)
})
# inspect result
plot(c(dem, rg),
plg = list(x = "bottomleft",
bty = "o",
bg = "white",
cex = 0.85))
```
# Citation
```{r}
citation("rgeomorphon")
```