grid_from_region: Creates grid for a given geographic region

Description Usage Arguments Value Examples

View source: R/pam_helpers.R

Description

Divides the region of interest in a grid of a specific cell size.

Usage

1
grid_from_region(region, cell_size, complete_cover = TRUE)

Arguments

region

SpatialPolygonsDataFrame of the region of interest. Object must be unprojected, World Geodetic System (WGS84).

cell_size

(numeric) resolution for grid (single number or vector of two numbers) in kilometers (km).

complete_cover

(logical) whether or not to include cells of grid partially overlapped with region. Default = TRUE.

Value

Gridded SpatialPolygonsDataFrame for the region of interest. Each grid cell is related to a specific ID and longitude and latitude coordinates.

Examples

1
2
3
4
5
6
7
8
# Data
data("mx", package = "biosurvey")

# Create grid from polygon
grid_reg <- grid_from_region(region = mx, cell_size = 100)

sp::plot(grid_reg)
grid_reg

biosurvey documentation built on Sept. 16, 2021, 1:07 a.m.