From 129b679c89a4ff9ba7f73dd5d59beb9bb734ace4 Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Tue, 24 Sep 2019 22:09:36 +0100 Subject: [PATCH] Update node function documentation --- man/rnet_add_node.Rd | 12 ++++++------ man/rnet_get_nodes.Rd | 2 +- man/route_nearest_point.Rd | 8 ++++---- man/route_split.Rd | 10 +++++----- man/route_split_id.Rd | 10 +++++----- man/sln_add_node.Rd | 18 +++++++++--------- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/man/rnet_add_node.Rd b/man/rnet_add_node.Rd index e66bbc66..2f9d5d17 100644 --- a/man/rnet_add_node.Rd +++ b/man/rnet_add_node.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{rnet_add_node} \alias{rnet_add_node} \title{Add a node to route network} @@ -15,11 +15,11 @@ rnet_add_node(rnet, p) Add a node to route network } \examples{ -sample_routes = routes_fast_sf[2:6, NULL] -sample_routes$value = rep(1:3, length.out = 5) -rnet = overline2(sample_routes, attrib = "value") -p = sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(rnet)) -r_split = route_split(rnet, p) +sample_routes <- routes_fast_sf[2:6, NULL] +sample_routes$value <- rep(1:3, length.out = 5) +rnet <- overline2(sample_routes, attrib = "value") +p <- sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(rnet)) +r_split <- route_split(rnet, p) plot(rnet$geometry, lwd = rnet$value * 5, col = "grey") plot(p, cex = 9, add = TRUE) plot(r_split, col = 1:nrow(r_split), add = TRUE, lwd = r_split$value) diff --git a/man/rnet_get_nodes.Rd b/man/rnet_get_nodes.Rd index 87949407..1f03004d 100644 --- a/man/rnet_get_nodes.Rd +++ b/man/rnet_get_nodes.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{rnet_get_nodes} \alias{rnet_get_nodes} \title{Extract nodes from route network} diff --git a/man/route_nearest_point.Rd b/man/route_nearest_point.Rd index b26dcccd..9a655e18 100644 --- a/man/route_nearest_point.Rd +++ b/man/route_nearest_point.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{route_nearest_point} \alias{route_nearest_point} \title{Find nearest route to a given point} @@ -18,10 +18,10 @@ This function was written as a drop-in replacement for \code{sf::st_nearest_feat which only works with recent versions of GEOS. } \examples{ -r = routes_fast_sf[2:6, NULL] -p = sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(r)) +r <- routes_fast_sf[2:6, NULL] +p <- sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(r)) route_nearest_point(r, p, id_out = TRUE) -r_nearest = route_nearest_point(r, p) +r_nearest <- route_nearest_point(r, p) plot(r$geometry) plot(p, add = TRUE) plot(r_nearest, lwd = 5, add = TRUE) diff --git a/man/route_split.Rd b/man/route_split.Rd index ed2ba813..e6efb2f1 100644 --- a/man/route_split.Rd +++ b/man/route_split.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{route_split} \alias{route_split} \title{Split route in two at point on or near network} @@ -18,11 +18,11 @@ An sf object with 2 feature Split route in two at point on or near network } \examples{ -sample_routes = routes_fast_sf[2:6, NULL] -r = sample_routes[2, ] -p = sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(r)) +sample_routes <- routes_fast_sf[2:6, NULL] +r <- sample_routes[2, ] +p <- sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(r)) plot(r$geometry, lwd = 9, col = "grey") plot(p, add = TRUE) -r_split = route_split(r, p) +r_split <- route_split(r, p) plot(r_split, col = c("red", "blue"), add = TRUE) } diff --git a/man/route_split_id.Rd b/man/route_split_id.Rd index 2b293c0f..607c8b39 100644 --- a/man/route_split_id.Rd +++ b/man/route_split_id.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{route_split_id} \alias{route_split_id} \title{Split route based on the id or coordinates of one of its vertices} @@ -17,10 +17,10 @@ route_split_id(r, id = NULL, p = NULL) Split route based on the id or coordinates of one of its vertices } \examples{ -sample_routes = routes_fast_sf[2:6, 3] -r = sample_routes[2, ] -id = round(n_vertices(r) / 2) -r_split = route_split_id(r, id = id) +sample_routes <- routes_fast_sf[2:6, 3] +r <- sample_routes[2, ] +id <- round(n_vertices(r) / 2) +r_split <- route_split_id(r, id = id) plot(r$geometry, lwd = 9, col = "grey") plot(r_split, col = c("red", "blue"), add = TRUE) } diff --git a/man/sln_add_node.Rd b/man/sln_add_node.Rd index c32f6334..b64efed1 100644 --- a/man/sln_add_node.Rd +++ b/man/sln_add_node.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/route-add-node.R +% Please edit documentation in R/node-funs.R \name{sln_add_node} \alias{sln_add_node} \title{Add node to spatial lines object} @@ -15,14 +15,14 @@ sln_add_node(sln, p) Add node to spatial lines object } \examples{ -sample_routes = routes_fast_sf[2:6, NULL] -sample_routes$value = rep(1:3, length.out = 5) -rnet = overline2(sample_routes, attrib = "value") -sln = SpatialLinesNetwork(rnet) -p = sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(rnet)) -sln_nodes = sln2points(sln) -sln_new = sln_add_node(sln, p) -route = route_local(sln_new, p, sln_nodes[9, ]) +sample_routes <- routes_fast_sf[2:6, NULL] +sample_routes$value <- rep(1:3, length.out = 5) +rnet <- overline2(sample_routes, attrib = "value") +sln <- SpatialLinesNetwork(rnet) +p <- sf::st_sfc(sf::st_point(c(-1.540, 53.826)), crs = sf::st_crs(rnet)) +sln_nodes <- sln2points(sln) +sln_new <- sln_add_node(sln, p) +route <- route_local(sln_new, p, sln_nodes[9, ]) plot(sln) plot(sln_nodes, pch = as.character(1:nrow(sln_nodes)), add = TRUE) plot(route$geometry, lwd = 9, add = TRUE)