Type: Package
Title: Interface to 'Rangeland Analysis Platform' (RAP) Products
Version: 1.0.0
Maintainer: Andrew Brown <andrew.g.brown@usda.gov>
Description: Provides access to 'Rangeland Analysis Platform' (RAP) products https://rangelands.app/products for arbitrary extents via 'GDAL' virtual file system.
License: GPL (≥ 3)
Encoding: UTF-8
URL: https://github.com/brownag/rapr/, https://humus.rocks/rapr/
BugReports: https://github.com/brownag/rapr/issues
RoxygenNote: 7.3.2
Language: en-US
Imports: terra
Suggests: sf, httr, leaflet, gifski, litedown, tinytest
VignetteBuilder: litedown
NeedsCompilation: no
Packaged: 2025-05-08 23:16:19 UTC; Andrew.G.Brown
Author: Andrew Brown ORCID iD [aut, cre], Georgia Harrison ORCID iD [ctb]
Repository: CRAN
Date/Publication: 2025-05-12 08:40:02 UTC

rapr: Interface to 'Rangeland Analysis Platform' (RAP) Products

Description

Provides access to 'Rangeland Analysis Platform' (RAP) products https://rangelands.app/products for arbitrary extents via 'GDAL' virtual file system.

Author(s)

Maintainer: Andrew Brown andrew.g.brown@usda.gov (ORCID)

Other contributors:

See Also

Useful links:


Get 'Rangeland Analysis Platform' (RAP) Grids

Description

Two sets of 'Rangeland Analysis Platform' (RAP) products are available (see source argument). "rap-30m" is Landsat-derived and has approximately 30 meter resolution in WGS84 decimal degrees ("EPSG:4326"). This is the data source that has been used in the 'rapr' package since 2022. A newer source (2025), "rap-10m", is Sentinel 2-derived and has 10 meter resolution in the local WGS84 UTM zone ("EPSG:326XX", where XX is the two digit UTM zone number). See Details for the products and bands available for the different resolutions and sources.

Usage

get_rap(
  x,
  years,
  product,
  filename = NULL,
  ...,
  source = "rap-30m",
  version = "v3",
  vrt = FALSE,
  sds = FALSE,
  legacy = FALSE,
  verbose = TRUE
)

Arguments

x

Target extent. Derived from an sf, terra, raster or sp object or numeric vector containing xmin, ymax, xmax, ymin in WGS84 decimal degrees (longitude/latitude, "EPSG:4326").

years

integer. Year(s) to query. Products are available from 1986 (source="rap-30m") or 2018 (source="rap-10m") up to the year prior to the current year, based on availability of the Landsat and Sentinel 2 source data.

product

Target data: "vegetation-biomass", "vegetation-cover", and/or "vegetation-npp" for source="rap-30m"; "pft" (plant functional type cover), "gap" (canopy gap), "arte" (Artemisia spp. cover), "iag" (invasive annual grass cover), or "pj" (pinyon juniper cover) for source="rap-10m".

filename

Output filename (optional; default stores in temporary file or in memory, see terra::tmpFiles())

...

Additional arguments passed to internal query function and terra::writeRaster() (or terra::vrt() when vrt=TRUE)

source

Grid sources. Options include "rap-30m" (default; Landsat) and "rap-10m" (Sentinel 2).

version

Target version: "v3" and/or "v2" (for "rap-30m"). Currently ignored for source="rap-10m".

vrt

logical. Short circuit to return Virtual Raster Dataset (VRT) for selected grids via terra::vrt(). Default: FALSE. Note: gdalbuildvrt does not support heterogeneous projection systems, so this option is not compatible with source="rap-10m" over multiple UTM zone areas of interest.

sds

logical. Return data as a SpatRasterDataset? Helpful for results containing multiple years and products. Default FALSE returns a SpatRaster object.

legacy

logical. Use legacy (gdal_translate) method? Default: TRUE (applies only to source="rap-30m").

verbose

logical. Print messages indicating progress? Default: TRUE. For legacy=TRUE progress is shown using utils::txtProgressBar().

Details

Sources, Products, and Band Information

For "rap-30m" you can query several Landsat derived annual biomass, cover, and Net Primary Productivity products from 1986 to present:

For "rap-10m" you can query several Sentinel 2 derived cover products at 10 meter resolution from 2018 to present:

Temporary Files

Large requests may generate intermediate objects that will be stored as temporary files. See terra::tmpFiles() to view the file paths. These files will be removed when an R session ends.

Alternate Specification of Area of Interest

In lieu of a spatial object from {terra}, {raster}, {sf} or {sp} packages you may specify a bounding box using a numeric vector containing the top-left and bottom-right coordinates (xmin, ymax, xmax, ymin) in WGS84 longitude/latitude decimal degrees. This corresponds to the conventional order used in the gdal_translate -projwin option. e.g. get_rap(x = c(-120, 37, -119.99, 36.99), ...).

(1: xmin, 2: ymax)--------------------------|
        |                                   |
        |         TARGET EXTENT             |
        |  x = c(xmin, ymax, xmax, ymin)    |
        |                                   |
        |---------------------------(3: xmax, 4: ymin)

Native Resolution and Projection Systems

Native cell resolution of "rap-30m" is approximately 30m x 30m in WGS84 geographic coordinate system (longitude, latitude). Native cell resolution of "rap-10m" is 10m x 10m in the local (projected) WGS84 Universal Transverse Mercator (UTM) system.

For "rap-10m" requests spanning multiple UTM zones, either pass a SpatRaster object as x or specify template argument. In lieu of a user-specified grid system for multi-zone requests, a default CONUS Albers Equal Area projection ("EPSG:5070") with 10 m resolution will be used. See rap_projection() for options and details.

Value

a SpatRaster containing the requested product layers by year. If sds=TRUE a SpatRasterDataset where each SpatRaster contains only one product (possibly with multiple years)

References

See citation("rapr") for all references related to Rangeland Analysis Platform products.

See Also

rap_projection()


Select Projection System for RAP Extent

Description

This function provides several "standard" projected Coordinate Reference Systems that are suitable for representing Rangeland Analysis Platform products across the contiguous (lower 487) United States at the specified resolution (in meters).

Usage

rap_projection(x, res)

Arguments

x

character. One of "CONUS_AEA", "CONUS_EQUI7", "CONUS_IGH"

res

integer. Resolution in meters.

Details

Currently there are three pre-calculated grid systems that have their extent designed to align at 1, 5, 10, 30, 100, and 300 meter resolutions.

"CONUS_AEA" is the default template used with get_rap(source="rap-10m") when data spanning multiple UTM zones are requested, unless user specifies their own template via SpatRaster object as x or template argument.

Grid Specifications

Value

A SpatRaster object using a standard extent (xmin,ymax,xmax,ymin), resolution and projected Coordinate Reference System.

See Also

get_rap()

Examples


rap_projection("CONUS_AEA", 10)

rap_projection("CONUS_IGH", 100)