Learn R Programming

cdlTools (version 1.13)

getCDL_bbox: Get CDL raster data for a bounding box

Description

getCDL_bbox retrieves a CDL raster object within a bounding box for a set of years.

Usage

getCDL_bbox(
  year,
  bbox,
  fileName,
  res,
  crs = "EPSG:5070",
  https = TRUE,
  alternativeUrl,
  ssl.verifypeer = TRUE,
  returnType = "raster"
)

Value

A raster object containing the contents of a bounding box.

Arguments

year

A numerical vector. A set of years of CDL data to download.

bbox

An array defining a bounding box of length four. Defining the two points that form the box by latitude then longitude, in that order. The furthest north west pair is entered first.

fileName

An optional string indicating where the file should be saved to, default is an R tempfile.

res

An optional array of length two defining the pixel resolution in meters, default is 30m.

crs

An optional string containing the coordinate reference system, default is EPSG:5070 (Albers is EPSG:5070).

https

Legacy https, all traffic uses https, if you need http provide alternative url.

alternativeUrl

An optional string containing an alternative url.

ssl.verifypeer

An optional boolean to turn on and off ssl verfication, default is on.

returnType

An optional parameter to select to return either 'raster' or 'terra' based raster files.

Author

Jonathan Lisic, jlisic@gmail.com

Jemma Stachelek, stachel2@msu.edu

Examples

Run this code
if (FALSE) {
# Get data for California in 2020
bbox <- c(130783,2203171,153923,2217961)
resx <- 30 
resy <- 30 
year <- 2020
crs <- 'epsg:102004'
getCDL_bbox(year,bbox,res=c(resx,resy),crs=crs)
}

Run the code above in your browser using DataLab