dist_btw_clicks | R Documentation |
This function calculates the distance between sequential mouse clicks on a plotted map, by combining locator
with a distance calculator, such as pointDistance
.
dist_btw_clicks(
calc_distance = raster::pointDistance,
...,
add_paths = list(length = 0.025)
)
calc_distance |
A function that calculates distances between two sets of points, such as |
... |
Additional arguments passed to |
add_paths |
(optional) A named list of arguments, passed to |
The function returns a dataframe with an integer ID for each path segment (‘segment’), the first and second x and y coordinates (‘x’, ‘x2’, ‘y’, ‘y2') and the distances between these points ('dist’). If add_paths
is not NULL
, the segments are drawn on the map.
Edward Lavender
## Not run:
raster::plot(dat_gebco)
dist_btw_clicks(lonlat = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.