deg2grid: Coordinates and Grids

View source: R/deg2grid.R

deg2gridR Documentation

Coordinates and Grids

Description

Functions to assign a grid label(s) given coordinates, and vice versa.

Usage

deg2grid(
  x,
  y,
  quarter.grid = FALSE,
  xref = -66 - 1/3,
  yref = 45,
  dx = 1/6,
  dy = 1/6,
  reference = "HP23"
)

grid2deg(
  x,
  xref = -66 - 1/3,
  yref = 45,
  dx = 1/6,
  dy = 1/6,
  reference = "HP23",
  vertices = FALSE
)

grid.scs(x, ...)

Arguments

x, y

Coordinate vectors (e.g. decimal longitude or latitude) or grid name.

quarter.grid

A logical value specifying whether the grid is to include northing and easting qualifiers.

xref, yref

Numerical values specifying the horizontal and vertical reference coordinates. Reference coordinates specify the location of the the lower-left corner of reference grid.

dx, dy

Numerical values specifying the width or height of each grid.

reference

A four-character string of the form XXYY, where XX are two letters and YY are two digits.

longitude, latitude

Vector of decimal longitude or latitude.

Functions

  • deg2grid(): Returns a grid name for a given coordinate(s).

  • grid2deg(): Returns the corner coordinates of a grid.

  • grid.scs(): Generic method for identifying a grid from the snow crab survey spatial design.

See Also

plot.grid

Examples

deg2grid(-64, 47) # Returns "HD37".
grid2deg("HD37")  # Return corner coordinates for "HD37".
grid2deg("HD37", vertices = TRUE)  # Return vertex coordinates for "HD37".

# Generate 100 random coordinates:
lon <- -66 + 6 * runif(100)
lat <- 45 + 4 * runif(100)
deg2grid(lon, lat)

# Single point:
grid.scs(-63, 47.5)

# Vector of points:
s <- read.scsset(2020)
grid.scs(lon(s), lat(s))
grid.scs(s) # Apply directly.

# Return survey grid definitions:
grid.scs()


TobieSurette/gulf.spatial documentation built on Sept. 26, 2024, 7:41 p.m.