GGdist: In-water distances between a set of points and the Golden...

View source: R/GGdist.R

GGdistR Documentation

In-water distances between a set of points and the Golden Gate

Description

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

Usage

GGdist(
  Water_map,
  Points,
  EndPoint = NULL,
  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 which you would like to calculate distance to a given reference point.

EndPoint

A dataframe containing a single point with latitude and longitude. Defaults to a point 92 m East of the Golden Gate (37.819539, -122.477). Latitude and longitude column names must be the same as the points data frame. This point must fall within the bounds of the Water_map.

Latitude_column

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

Longitude_column

The unquoted name of the column in the Points and EndPoint 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

A tibble with 1 column for the PointID_column values and another with the distances from the EndPoint.

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<GGdist(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<-GGdist(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.