Learn R Programming

geocausal (version 0.4.0)

get_dist_line: Get distance maps from lines and polygons

Description

`get_dist_line()` generates a distance map from lines and polygons.

Usage

get_dist_line(
  window,
  path_to_shapefile = NULL,
  line_data = NULL,
  mile = FALSE,
  resolution = NULL,
  ndim = NULL,
  preprocess = TRUE,
  unit_scale = 1000
)

Value

an im object

Arguments

window

owin object

path_to_shapefile

path to shapefile

line_data

sfc_MULTILINESTRING file (If available. If not, `get_dist_line()` creates it from a shapefile.)

mile

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

resolution

resolution of raster objects (distance map) (in km; by default, 1). Ignored if ndim is set.

ndim

number of pixels for both dimensions (e.g., 256 for 256x256). If set, resolution is ignored.

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.

unit_scale

set to the same value as the parameter in `get_window()` function. This parameter converts the coordinate values so that they alingn with the unit (km) of the owin object

Details

The function ensures spatial integrity by automatically projecting the line_data or shapefile to match the Coordinate Reference System (CRS) of the window.