Skip to content

Commit bb59a53

Browse files
committed
export net_2_sfnet_undirected and update example
1 parent f5977df commit bb59a53

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ S3method(oe_match_pattern,sfc)
1717
S3method(print,oe_key_values_list)
1818
export(clean_oneway)
1919
export(get_default_osmconf_ini)
20+
export(net_2_sfnet_undirected)
2021
export(oe_clean)
2122
export(oe_download)
2223
export(oe_download_directory)

R/get-network-graph.R

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,30 @@ oe_get_sfnetwork = function(
166166
#' All other attributes are collapsed separated by a comma.
167167
#'
168168
#' @returns An `sfnetwork` object
169+
#' @export
169170
#'
170171
#' @examples
171-
#' \dontrun{
172-
#' net_sf <- oe_get_network(place = "ITS Leeds", mode = "driving",clean_output = TRUE)
172+
#' # Copy the ITS file to tempdir() to make sure that the examples do not
173+
#' # require internet connection. You can skip the next 4 lines (and start
174+
#' # directly with oe_get_keys) when running the examples locally.
175+
#' its_pbf = file.path(tempdir(), "test_its-example.osm.pbf")
176+
#' file.copy(
177+
#' from = system.file("its-example.osm.pbf", package = "osmextract"),
178+
#' to = its_pbf,
179+
#' overwrite = TRUE
180+
#' )
181+
#'
182+
#' net_sf <- oe_get_network(
183+
#' place = "ITS Leeds",
184+
#' mode = "driving",
185+
#' clean_output = TRUE,
186+
#' download_directory = tempdir(),
187+
#' quiet = TRUE
188+
#' )
173189
#'
174-
#' sfnet_undirected <- net_2_sfnet_undirected(net_sf)
190+
#' if (requireNamespace("sfnetworks", quietly = TRUE)) {
191+
#' sfnet_undirected <- net_2_sfnet_undirected(net_sf)
192+
#' plot(sfnet_undirected)
175193
#' }
176194
net_2_sfnet_undirected = function(net_sf, require_equal = TRUE) {
177195
if (!requireNamespace("sfnetworks", quietly = TRUE)) {

man/net_2_sfnet_undirected.Rd

Lines changed: 20 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)