luukvdmeer / Sfnetworks
Programming Languages
Projects that are alternatives of or similar to Sfnetworks
Tidy Geospatial Networks in R
sfnetworks
is an R package for analysis of geospatial networks. It connects the functionalities of the tidygraph
package for network analysis and the sf
package for spatial data science.
Background
Thanks to active developer and user communities, R is becoming an increasingly popular language for interactive geospatial data analysis. A large step forward was the release of the sf package, which provides classes and functions to represent and manipulate spatial vector data. Unlike its predecessors, sf
is compatible with the popular data science oriented packages that form the tidyverse, most notably the data manipulation toolbox dplyr, and more generally with the concept of tidy data.
R is also well-suited for network analysis, thanks to the R interface of the igraph library. The tidygraph package extends igraph
into the domain of the tidyverse, enabling compatibility with dplyr
by treating a graph as a collection of two tidy data frames describing respectively the nodes and edges.
Given the strength of R in spatial and network analysis, one would expect it to be an ideal language for analysis of geospatial networks. Geospatial networks are simultaneously graph and spatial objects, with nodes and edges embedded in geographic space. Well known examples include transport networks, river basins, power grids, ecological networks and geolocated social networks.
Although several R packages exist that address geospatial networks, they often focus on a specific application within the broader domain of geospatial network analysis, or complicate tidyverse compatibility. At present, no general purpose, tidyverse compatible classes exist for geospatial network data, representing a gap in R's spatial and network analysis ecosystems (see the gRaphical Models and Spatial task views). sfnetworks
is created to fill this gap, and form a connecting edge between the two worlds.
The core of the package is a data structure that can be provided as input to both graph analytical functions of tidygraph
and to spatial analytical functions of sf
, without the need for conversion. On top of that, it contains a set of spatial network specific functions that can be used alongside the offer of the two 'parent packages'.
Installation
You can install the latest stable version of sfnetworks
from CRAN with:
install.packages("sfnetworks")
The sfnetworks
package is still in very active development, Therefore, the package is also not on CRAN yet. Install it directly from GitHub using the remotes
package in R.
You can install the development version from GitHub with:
remotes::install_github("luukvdmeer/sfnetworks")
Note: Two important dependencies of sfnetworks
, the sf
package for spatial data science and the igraph
package for network analysis, require some low-level software libraries to be installed on your system. Depending on which operating system you use, this can mean that you have to install these system requirements first, before you can install sfnetworks
. See the installation guides of sf and igraph for details.
Usage
The main goal of sfnetworks
is to connect the tidygraph
package for network analysis and the sf
package for spatial data science. To make the most out of it, it is recommended to make yourself familiar with these two 'parent packages' if you don't know them yet.
There are currently five vignettes that guide you through the functionalities of sfnetworks
:
- The sfnetwork data structure
- Network pre-processing and cleaning
- Spatial joins and filters
- Routing
- Spatial morphers
(GIF (c) by Lore Abad)
Contribution
We look very much forward to contributions to the package. See the contributing guide for further details.
This project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Acknowledgment
This project gratefully acknowledges financial support from the