make_grid: Create a spatial grid

View source: R/make_grid.R

make_gridR Documentation

Create a spatial grid

Description

Create a spatial grid

Usage

make_grid(xlims, ylims, grid_int = 1)

Arguments

xlims

A two-element numeric vector for the left and right limits of your grid, in decimal degrees of longitude in which W coordinates are negative.

ylims

A two-element numeric vector for the bottom and top limits of your grid, in decimal degrees of latitude.

grid_int

The target interval (in north-south km) represented by each grid cell. This interval will be translated to degrees latitude and longitude. If your target is a square km, you may need to adjust this slightly to account for the smaller distance represented by a degree of longitude at higher latitudes.

Value

A data.frame with a row for every grid cell and the following columns:

  • y1 Bottom (southern) latitude boundary of the grid cell

  • y2 Top (northern) latitude boundary of the grid cell

  • y Center latitude of the grid cell

  • x1 Left (western) longitude of the grid cell

  • x2 Right (easter) longitude of the grid cell

  • x Center longitude of the grid cell

  • km2 Spatial area of the grid cell, in square km

  • id A unique identifier for each grid cell (1:nrow(grid))


ericmkeen/shipstrike documentation built on May 21, 2023, 7:05 a.m.