Waterdist: In-water distances between points

View source: R/Waterdist.R

WaterdistR Documentation

In-water distances between points

Description

Calculate a distance matrix for a set of points based on in-water distances, using a raster-based approach

Usage

Waterdist(
  Water_map,
  Points,
  Latitude_column,
  Longitude_column,
  PointID_column,
  Points_crs = 4326,
  Water_map_transitioned = NULL,
  Calculation_crs = 32610,
  Grid_size = 75
)

Arguments

Water_map

Object of class sf representing a map of all waterways in your region of interest

Points

A dataframe of points with latitude and longitude

Latitude_column

The unquoted name of the column in the Points dataframe representing Latitude.

Longitude_column

The unquoted name of the column in the Points dataframe representing Longitude.

PointID_column

The unquoted name of the column in the Points dataframe with the unique identifier of each point.

Points_crs

Coordinate reference system for your Points dataframe. Integer with the EPSG code or character with proj4string.

Water_map_transitioned

A rasterized, transitioned, and geo-corrected version of the water map. This is optional to save time if you will be running this function frequently with the same base map.

Calculation_crs

Coordinate reference system used for the calculation. If a latitude/longitude system are used, errors may be returned since some calculations assume a planar surface. Defaults to Calculation_crs = 32610.

Grid_size

Grid size (in meters) used to rasterize the map. Defaults to 75.

Value

Distance matrix.

See Also

Maptransitioner Pointmover

Examples

library(tibble)

Points <- tibble(Latitude = c(38.23333, 38.04813, 38.05920,
                                      37.94900, 38.23615, 38.47387),
                         Longitude = c(-121.4889, -121.9149, -121.8684,
                                       -121.5591, -121.6735, -121.5844),
                         ID = c("EMP NZP02", "FMWT 508", "FMWT 513",
                                "FMWT 915", "FMWT 723", "FMWT 796"))

## Not run: 
distance<-Waterdist(Water_map = spacetools::Delta, Points = Points, Latitude_column = Latitude,
                    Longitude_column = Longitude, PointID_column = ID)


# Including a pre-transitioned map to save time.
# See Maptransitioner for creating this pre-transitioned map.

distance<-Waterdist(Water_map = spacetools::Delta, Points = Points, Latitude_column = Latitude,
                    Longitude_column = Longitude, PointID_column = ID,
                    Water_map_transitioned = Delta_transitioned)
                    
## End(Not run)

sbashevkin/spacetools documentation built on Feb. 2, 2024, 9:15 p.m.