View source: R/coords_to_node.R
coords_to_node | R Documentation |
The function coords_to_node
can be used to find the nearest nodes in the Norwegian road network (in meters) for chosen coordinates.
coords_to_node( coords, nodes_object = nodes, edges_object = edges, direction = "from", ID_col = "ID", crs_out = 25833, knn = 1, membership = FALSE )
coords |
An |
nodes_object |
An |
edges_object |
A data frame with the edges of the road network. This can be created with the function |
direction |
Character vector with |
ID_col |
Character vector with the name of the ID column. Default value is set to “ID”. |
crs_out |
Numeric vector for the chosen coordinate reference system (CRS). |
knn |
Numeric vector with the chosen number of nodes that should be returned for each of the coordinates. If |
membership |
Logical. If |
Before the function can be used, the nodes of the road network must be converted to an sf
object that is called nodes
(or another name supplied to the nodes_object
argument). This can be done with the function vegnett_to_R()
.
An object (data.frame
) with the following columns; from_nodeID
/to_nodeID
, membership_from_node
/membership_to_node
, coords_google_from_node
/coords_google_to_node
, knn_from_node
/knn_to_node
, and ID
.
coords <- address_to_coords(zip_code = "0185", address = "Schweigaards gate 10") coords_to_node(coords = coords, direction = "from", nodes_object = nodes_sampledata, edges_object = edges_sampledata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.