graphab_pointset: Add a point set to the Graphab project

View source: R/graphab_pointset.R

graphab_pointsetR Documentation

Add a point set to the Graphab project

Description

The function adds a spatial point set to the Graphab project, allowing users to identify closest habitat patch from each point and get corresponding connectivity metrics.

Usage

graphab_pointset(
  proj_name,
  linkset,
  pointset,
  id = "ID",
  return_val = TRUE,
  proj_path = NULL,
  alloc_ram = NULL
)

Arguments

proj_name

A character string indicating the Graphab project name. The project name is also the name of the project directory in which the file proj_name.xml is.

linkset

A character string indicating the name of the link set used. The link set is here used to get the defined cost values and compute the distance from the point to the patches. Link sets can be created with graphab_link.

pointset

Can be either;

  • A character string indicating the path (absolute or relative) to a shapefile point layer

  • A character string indicating the path to a .csv file with three columns: ID, x and y, respectively indicating the point ID, longitude and latitude.

  • A data.frame with three columns: ID, x and y, respectively indicating the point ID, longitude and latitude.

  • A SpatialPointsDataFrame

The point ID column must be 'ID' by default but can also be specified by the id argument in all three cases.

id

A character string indicating the name of the column in either the .csv table, data.frame or attribute table, corresponding to the ID of the points. By default, it should be 'ID'. This column is used for naming the points when returning the output.

return_val

Logical (default=TRUE) indicating whether the metrics associated with closest habitat patches from the points are returned to users.

proj_path

(optional) A character string indicating the path to the directory that contains the project directory. It should be used when the project directory is not in the current working directory. Default is NULL. When 'proj_path = NULL', the project directory is equal to getwd().

alloc_ram

(optional, default = NULL) Integer or numeric value indicating RAM gigabytes allocated to the java process. Increasing this value can speed up the computations. Too large values may not be compatible with your machine settings.

Details

Point coordinates must be in the same coordinate reference system as the habitat patches (and initial raster layer). See more information in Graphab 2.8 manual: https://sourcesup.renater.fr/www/graphab/download/manual-2.8-en.pdf

Value

If return_val=TRUE, the function returns a data.frame with the properties of the nearest patch to every point in the point set, as well as the distance from each point to the nearest patch.

Author(s)

P. Savary

Examples

## Not run: 
graphab_pointset(proj_name = "grphb_ex",
               graph = "graph",
               pointset = "pts.shp")

## End(Not run)

graph4lg documentation built on Feb. 16, 2023, 5:43 p.m.