Learn R Programming

geocausal (version 0.3.2)

get_dist_focus: Get distance maps

Description

`get_dist_focus()` generates a distance map from focus locations.

Usage

get_dist_focus(window, lon, lat, resolution, mile = FALSE, preprocess = FALSE)

Value

an im object

Arguments

window

owin object

lon

vector of longitudes

lat

vector of latitudes

resolution

resolution of raster objects

mile

logical. `mile` specifies whether to return the output in miles instead of kilometers (by default, FALSE).

preprocess

logical. `preprocess` specifies whether to first pick the potentially closest point. It is recommended to set `preprocess = TRUE` if users need to obtain distances from many points.

Details

`get_dist_focus()` depends on `geosphere::distVincentyEllipsoid()`. Since it calculates accurate distances considering the ellipsoid, the process sometimes becomes computationally demanding, namely when we need to obtain distances from many points. In that case, users can set `preprocess = TRUE`. With this option, `get_dist_focus()` calculates distances from points by first identifying the closest point using `sf::st_nearest_feature()` with approximations. This process is more efficient than computing distances from all the points with `geosphere::distVincentyEllipsoid()` and then obtaining the minimum of all the distances. By default, `get_dist_focus()` returns distances in kilometers unless users set `mile = TRUE`.