View source: R/join_points_lines.R
join_points_lines | R Documentation |
This function allows you to get the coordinates for the closests point in a line for an input point. This function uses the snapPointsToLines from the sp package but accept sf as inputs. The process must be made in geographic coordinates, so if the sf inputs are in lon/lat coordinates, they must be tranformed. If no crs is specified as projected, the default crs is 3116. A crs for the output can also be choosen, by default, the result will be in crs 4326 (WGS84)
join_points_lines(points, lines, crs_projected = NULL, crs_out = NULL)
points |
The sf object containing points |
lines |
The sf object containing lines |
crs_projected |
The crs which will be used to find the neares points and calculete euclidean distances |
crs_out |
The crs used for the coordinates at the final dataframe |
A dataframe containing the origin id, coordinates, and the destination coordinates as lon_dest and lat_dest
destino_bici <- join_points_lines(direcciones, ciclorruta) %>%
select(id, lon_dest, lat_dest)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.