st_network_iso | R Documentation |
Isolines are curves along which a function has a constant value. In spatial networks, they are used to delineate areas that are reachable from a given node within a given travel cost. If the travel cost is distance, they are known as isodistances, while if the travel cost is time, they are known as isochrones. This function finds all network nodes that lie inside an isoline around a specified node.
st_network_iso(
x,
node,
cost,
weights = edge_length(),
...,
delineate = TRUE,
ratio = 1,
allow_holes = FALSE
)
x |
An object of class |
node |
The node around which the isolines will be drawn. Evaluated by
|
cost |
The constant cost value of the isoline. Should be a numeric
value in the same units as the given edge weights. Alternatively, units can
be specified explicitly by providing a |
weights |
The edge weights to be used in the shortest path calculation.
Evaluated by |
... |
Additional arguments passed on to |
delineate |
Should the nodes inside the isoline be delineated? If
|
ratio |
The ratio of the concave hull. Defaults to |
allow_holes |
May the concave hull have holes? Defaults to |
An object of class sf
with one row per requested
isoline. The object contains the following columns:
cost
: The constant cost value of the isoline.
geometry
: If delineate = TRUE
, the concave hull of all
nodes that lie inside the isoline. Otherwise, those nodes combined into a
single MULTIPOINT
geometry.
library(sf, quietly = TRUE)
oldpar = par(no.readonly = TRUE)
par(mar = c(1,1,1,1))
center = st_centroid(st_combine(st_geometry(roxel)))
net = as_sfnetwork(roxel, directed = FALSE)
iso = net |>
st_network_iso(node_is_nearest(center), c(1000, 500, 250))
colors = c("#fee6ce90", "#fdae6b90", "#e6550d90")
plot(net)
plot(st_geometry(iso), col = colors, add = TRUE)
# The level of detail can be increased with the ratio argument.
# This requires GEOS >= 3.11.
if (compareVersion(sf_extSoftVersion()[["GEOS"]], "3.11.0") > -1) {
iso = net |>
st_network_iso(node_is_nearest(center), c(1000, 500, 250), ratio = 0.3)
colors = c("#fee6ce90", "#fdae6b90", "#e6550d90")
plot(net)
plot(st_geometry(iso), col = colors, add = TRUE)
}
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.