Calculate Slopes of Roads, Rivers and Trajectories
Overview
Calculates the slope (longitudinal gradient or steepness) of linear geographic features such as roads (for more details, see Ariza-López et al. (2019) doi:10.1038/s41597-019-0147-x) and rivers (for more details, see Cohen et al. (2018) doi:10.1016/j.jhydrol.2018.06.066). It can use local Digital Elevation Model (DEM) data or download DEM data via the 'ceramic' package. The package also provides functions to add elevation data to linestrings and visualize elevation profiles.
- Migrated from the deprecated
rasterpackage toterra(closes #60).terrais now a hard dependency (Imports);rasteris no longer required or suggested. elevation_extract(),slope_raster(), andelevation_add()now always useterra. Theterra =argument is deprecated (with a message) and ignored.elevation_get()now always returns aSpatRaster. Theoutput_format =argument is deprecated and ignored.slope_matrix_to_raster()andslope_xyz_simple()now work withSpatRasterobjects. LegacyRaster*objects are accepted with an automatic conversion message for backwards compatibility.- The bundled dataset has been renamed from
dem_lisbon_rastertodem_lisbonand is now aSpatRasterobject (was aRasterLayer). - Fixed CRAN
--run-donttestfailure: theceramic/Mapbox-dependent example inelevation_add()is now wrapped in\dontrun{}instead of\donttest{}(closes #72).
Show all changes in 2.0.0Hide the rest of the changes in 2.0.0
- Fixed
slopes_palette()hardcoded testing logic, allowing it to correctly return any number of requested colors for the "Green-Brown" palette. - Substantially improved overall package test coverage (from ~59% to over 84%) by adding test wrappers for plot functions and matrix conversion utilities.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 37
- Examples that run
- 100%6 run in a plain check
- Exported functions with examples
- 26%
- Documented parameters
- 99%
- Return-value docs
- 91%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 93%
- Median days to close, 50 most recently updated closed issues
- 68
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
15 development-tooling and community-health practices detected across 8 families in the upstream repository
Checks run against github.com/ropensci/slopes on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-06-16
pkgdown site last built 2026-06-16, before release 2.0.0 (2026-06-25)
Show all practicesHide 4 practices
This repository shows signs of AI coding tools.
- GitHub Copilotfirst seen 2026-05-28Pull request: opened by its own account
Dependencies
Installing slopes adds 13 packages (11 with compiled code, 21 MB of source tarballs). Heaviest: sf 9.3 MB, s2 2.8 MB, colorspace 2.0 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 2.0.0Latest
- unarchivedReturned to CRAN2026-06-17
- 1.0.22026-06-17 · diff ↗ ·
removed 9 exports
z_cumulative_difference, z_direction, z_elevation_change_start_end, z_end, z_max, z_mean, z_min, z_start, z_valueadded 6 exports
dem_lisbon, route_to_segments, slope_matrices, slope_matrix_to_raster, slope_xyz_simple, slopes_palette - archivedRemoved from CRAN2026-05-24issues were not corrected in time
- RR 4.6.0 released · 2026-04-24
- 1.0.12025-06-23
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-06-23
- Total releases
- 3 / 1 yrs
- License
- GPL-3 OSI
- Minimum R
- ≥ 2.10
- Bundled data
- 109 KB / 9 files
- Download size
- 2.1 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("slopes")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.