| Title: | Geographic Networks |
|---|---|
| Description: | Provides classes and methods for handling networks or graphs whose nodes are geographical (i.e. locations in the globe). The functionality includes the creation of objects of class geonetwork as a graph with node coordinates, the computation of network measures, the support of spatial operations (projection to different Coordinate Reference Systems, handling of bounding boxes, etc.) and the plotting of the geonetwork object combined with supplementary cartography for spatial representation. |
| Authors: | Facundo Muñoz [aut, cre] (ORCID: <https://orcid.org/0000-0002-5061-4241>) |
| Maintainer: | Facundo Muñoz <[email protected]> |
| License: | GPL-3 | file LICENSE |
| Version: | 0.6.0.9000 |
| Built: | 2026-09-16 11:17:46 UTC |
| Source: | https://gitlab.cirad.fr/astre/geonetwork |
A geonetwork object representing a full graph of 21
European cities with edges weighted by distance in km.
eurodisteurodist
geonetwork.
Distances (in km) between 21 European cities are taken
from eurodist. Coordinates of the cities
were obtained with geocode_OSM.
Create an igraph object with geospatial attributes for the
nodes.
geonetwork(edges, nodes, directed = TRUE, CRS = 4326)geonetwork(edges, nodes, directed = TRUE, CRS = 4326)
edges |
data.frame. Edges list and attributes. See Details. |
nodes |
data.frame. Nodes list and attributes. See Details. |
directed |
logical. Default is to build a directed graph. |
CRS |
Coordinate Reference System, as a numeric or character code, an object of class [sf::sf] or [sf::sfc], or a 'src' object as built by function [sf::st_crs]. |
The first two columns in edges must be character or factor,
and match the node names in the first column of the nodes
data.frame. The third column, if any, will be used as edge weights.
The remaining columns will be used as additional edge attributes.
The first column in nodes must be character or factor and
provide node names or labels, not necessarily unique. Columns 2
and 3 must be numeric coordinates in the Coordinate Reference
System specified in CRS.
An object of class geonetwork, which also inherits
from igraph.
e <- data.frame(from = c("A", "A"), to = c("B", "C")) n <- data.frame(id = LETTERS[1:3], x = c(0, 0, 1), y = c(0, 1, 0)) geonetwork(e, n)e <- data.frame(from = c("A", "A"), to = c("B", "C")) n <- data.frame(id = LETTERS[1:3], x = c(0, 0, 1), y = c(0, 1, 0)) geonetwork(e, n)
Plot one or more attributes of a geonetwork on a map
## S3 method for class 'geonetwork' plot(x, y, ...)## S3 method for class 'geonetwork' plot(x, y, ...)
x |
Object of class |
y |
Ignored. |
... |
Further specifications passed to plot_sf. |
plot(eurodist, axes = TRUE, type = "n") plot(sf::st_geometry(spData::world), col = "lightgray", add = TRUE) plot(eurodist, axes = TRUE, add = TRUE)plot(eurodist, axes = TRUE, type = "n") plot(sf::st_geometry(spData::world), col = "lightgray", add = TRUE) plot(eurodist, axes = TRUE, add = TRUE)