Description Usage Arguments Value Examples
A function that retrieves CDL raster data for any area of interests for a year.
1 |
aoi |
Area of interest. Could be a county FIPS code, a coordinate with two numeric values, multiple coordinates (e.g, three coordinates that defines a triangle),
or four values that defines a rectangle. The default coordinate system (used by CDL) is the Albers equal-area conic projection, or Albers projection. Users can provide
coordinates from a different projection method, but user have to specify the coordinate system in the |
year |
year of data to request. Can be a numerical value or a character. |
type |
type of aoi. 'f' for county, 'ps' for points, 'b' for box, 'p' for a single point. |
mat |
TRUE/FALSE. If FALSE (default), return a raster file; if TRUE, return a matrix that saves the data. |
crs |
projection system for the coordinate, such as '+init=epsg:4326' for longitude/latitude. |
The function returns a raster file or a matrix that saves the land use information. The file that links the category codes with the category names are available at~https://www.nass.usda.gov/Research_and_Science/Cropland/docs/cdl_codes_names.xlsx.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Example 1. Retrieve data for the Champaign county in Illinois (FIPS = 17109) in 2018.
data <- GetCDLData(aoi = 17019, year = 2018, type = 'f')
raster::plot(data) # plot the data.
# Example 2. Retrieve data for a single point by long/lat in 2018.
data <- GetCDLData(aoi = c(-94.6754,42.1197), year = 2018, type = 'p', crs = '+init=epsg:4326')
data
# Below uses the same point, but under the default coordinate system
data <- GetCDLData(aoi = c(108777,2125055), year = 2018, type = 'p')
data
# Example 3. Retrieve data for a triangle defined by three coordinates in 2018.
data <- GetCDLData(aoi = c(175207,2219600,175207,2235525,213693,2219600), year = 2018, type = 'ps')
raster::plot(data)
# Example 4. Retrieve data for a rectangle box defined by three corner points in 2018.
data <- GetCDLData(aoi = c(130783,2203171,153923,2217961), year = '2018', type = 'b')
raster::plot(data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.