shape2Grid: shape2Grid: Function to create a grid given a spatial polygon

View source: R/shape2Grid.R

shape2GridR Documentation

shape2Grid: Function to create a grid given a spatial polygon

Description

shapeToGrid creates a raster grid given a spatial polygon and a grid resolution.

Usage

shape2Grid(shpolygon, resolution, ones = TRUE)

Arguments

shpolygon

A SpatialPolygon, SpatialPolygonDataFrame representing the desired shape of the grid.

resolution

Numeric. Spatial resoltion of the grid.

ones

Logical. Fill with ones the values of the raster. If not the values will be written as cellID values.

Value

Returns a raster object whith the shape of 'shpolygon' of a given resoltion.

Examples

## Not run: 
data("wrld_simpl", package = "maptools")
mx <- wrld_simpl[wrld_simpl$NAME=="Mexico",]
mx_grid <- bam::shape2Grid(mx,0.5)

## End(Not run)

luismurao/bam documentation built on Nov. 28, 2022, 3:02 p.m.