Rosa Félix is a PhD in Transportation Systems and urban cycling mobility researcher at U-Shift lab. Rosa is skilled in GIS and R. She is a cycling activist in Lisbon, and project coordinator of a local community bicycle shop.
Slopes are important for many purposes, including flood risk, agriculture, geology, and infrastructure constructions.
In transport planning, consideration of gradient is especially important for walking and cycling routes, which provided our initial motivation for developing this package.
Slope gradient attributes of vector geometries can be calculated using proprietary products such as ArcMap. But to enable transparency, reproducibility and accessibility of used methods, we want to be able to calculate slopes using free and open source software.
We developed an R package - slopes - due prior experience with the language and the mature 'R-spatial' community which has developed mature codebases for working with geographic data in a reproducible command line environment, including
sf (for working with vector datasets representing roads and other linear features) and
raster (for representing digital elevation models, DEMs).
Building on these foundations the slopes package is now working and has been used to calculate slopes on thousand of roads in several cities across the globe, as long as it has elevation data to work with.
Comparison with ArcMap's 3D analyst show that the approach is competitive with the go-to proprietary produce in terms of computational speed and that we can reproduce ArcMap's results: tests show an R-squared value of 0.977.
We hope the package will be of use and interest to the FOSS4G and in the talk will discuss ideas for taking the work forward, e.g. by implementing the logic into other languages/environments such as Rust, Python and even as a QGIS plugin.
Could there be scope for an inter-disciplinary and language-agnostic community interested in slope analysis?
We would like support efforts to strengthen links between geospatial developers who use R and the wider FOSS4G community, for example by comparing the slopes package with other open source approaches for slope calculation and analysis for mutually beneficial learning.
We will conclude with discussion of possible future directions of travel for the project, including possibilities for 3D visualisation, auto-download of elevation point data sampled across linear features (currently the package automates the download of DEM data but requires a MapBox API key) and using the slope values to enter as a variable in route choice algorithms in route networks, as well as generate evidence in support of sustainable transport policies.