| Title: | Interface to 'LANDFIRE Product Service' API |
|---|---|
| Description: | Provides access to a suite of geospatial data layers for wildfire management, fuel modeling, ecology, natural resource management, climate, conservation, etc., via the 'LANDFIRE' (<https://www.landfire.gov/>) Product Service ('LFPS') API. |
| Authors: | Mark Buckner [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-9692-7454>) |
| Maintainer: | Mark Buckner <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.0.2 |
| Built: | 2026-05-19 05:56:28 UTC |
| Source: | https://github.com/bcknr/rlandfire |
cancelJob() sends a request to cancel a LFPS API request
cancelJob(job_id)cancelJob(job_id)
job_id |
The job ID of the LFPS API request as a character string |
NULL. Prints a message to the console about the job status.
## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]>" resp <- landfireAPIv2(products, aoi, email, background = TRUE) job_id <- resp$request$job_id #Get job_id from a previous request cancelJob("job_id") ## End(Not run)## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]>" resp <- landfireAPIv2(products, aoi, email, background = TRUE) job_id <- resp$request$job_id #Get job_id from a previous request cancelJob("job_id") ## End(Not run)
checkStatus checks if a previous request is complete and downloads available data
checkStatus(landfire_api, verbose = TRUE, method = "curl")checkStatus(landfire_api, verbose = TRUE, method = "curl")
landfire_api |
|
verbose |
If FALSE suppress all status messages |
method |
Passed to |
Returns a landfire_api object with named elements:
request - list with elements query, date, url, job_id, request,dwl_url
content - Informative messages passed from API
response - Full response
status - Final API status, one of "Failed", "Succeeded", or "Timed out"
time - time of job completion
path - path to save directory
## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]" resp <- landfireAPIv2(products, aoi, email, background = TRUE) checkStatus(resp) ## End(Not run)## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]" resp <- landfireAPIv2(products, aoi, email, background = TRUE) checkStatus(resp) ## End(Not run)
landfireAPI()
getAOI creates an extent vector in WGS84 from spatial data
getAOI(data, extend = NULL, sf_order = FALSE)getAOI(data, extend = NULL, sf_order = FALSE)
data |
A SpatRaster, SpatVector, sf, stars, or RasterLayer (raster) object |
extend |
Optional. A numeric vector of 1, 2, or 4 elements to increase the extent by. |
sf_order |
If |
Returns an extent vector ordered xmin, ymin, xmax, ymax
with a lat/lon projection.
r <- terra::rast(nrows = 50, ncols = 50, xmin = -123.7835, xmax = -123.6352, ymin = 41.7534, ymax = 41.8042, crs = terra::crs("epsg:4326"), vals = rnorm(2500)) ext <- getAOI(r, c(10, 15))r <- terra::rast(nrows = 50, ncols = 50, xmin = -123.7835, xmax = -123.6352, ymin = 41.7534, ymax = 41.8042, crs = terra::crs("epsg:4326"), vals = rnorm(2500)) ext <- getAOI(r, c(10, 15))
landfireAPI()
getZone returns the LANDFIRE Map Zone(s) a spatial object intersects or the
zone number from the zone name. Currently, only map zones within CONUS are
supported.
getZone(data)getZone(data)
data |
An sf object or character string with the map zone name. |
Returns a numeric vector containing the map zone(s)
## Not run: v <- sf::st_bbox(sf::st_as_sf(data.frame(x = c(-123.7835,-123.6352), y = c(41.7534,41.8042)), coords = c("x", "y"), crs = 4326)) |> sf::st_as_sfc() zone <- getZone(v) ## End(Not run)## Not run: v <- sf::st_bbox(sf::st_as_sf(data.frame(x = c(-123.7835,-123.6352), y = c(41.7534,41.8042)), coords = c("x", "y"), crs = 4326)) |> sf::st_as_sfc() zone <- getZone(v) ## End(Not run)
healthCheck() checks if the LPFS API is available
healthCheck()healthCheck()
NULL. Prints a message to the console about the current LFPS status.
## Not run: healthCheck() ## End(Not run)## Not run: healthCheck() ## End(Not run)
Superseded: landfireAPI() is no longer supported due to updates to the
LFPS API. Use landfireAPIv2() instead.
landfireAPI downloads LANDFIRE data by calling the LFPS API
landfireAPI( products, aoi, projection = NULL, resolution = NULL, edit_rule = NULL, edit_mask = NULL, path = NULL, max_time = 10000, method = "curl", verbose = TRUE )landfireAPI( products, aoi, projection = NULL, resolution = NULL, edit_rule = NULL, edit_mask = NULL, path = NULL, max_time = 10000, method = "curl", verbose = TRUE )
products |
Product names as character vector (see: Products Table) |
aoi |
Area of interest as character or numeric vector defined by
latitude and longitude in decimal degrees in WGS84 and ordered
|
projection |
Optional. A numeric value of the WKID for the output projection Default is a localized Albers projection. |
resolution |
Optional. A numeric value between 30-9999 specifying the resample resolution in meters. Default is 30m. |
edit_rule |
Optional. A list of character vectors ordered "operator class" "product", "operator", "value". Limited to fuel theme products only. (see: LFPS Guide) |
edit_mask |
Optional. Not currently functional |
path |
Path to |
max_time |
Maximum time, in seconds, to wait for job to be completed. |
method |
Passed to |
verbose |
If FALSE suppress all status messages |
Returns a landfire_api object with named elements:
request - list with elements query, date, url, job_id,dwl_url
content - Informative messages passed from API
response - Full response
status - Final API status, one of "Failed", "Succeeded", or "Timed out"
path - path to save directory
## Not run: products <- c("LF2020_ASP", "LF2020_ELEV", "LF2022_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","LF2020_ELEV","lt",500), c("change", "LF2022_CC", "st", 181)) save_file <- tempfile(fileext = ".zip") resp <- landfireAPI(products, aoi, projection, resolution, edit_rule = edit_rule, path = save_file) ## End(Not run)## Not run: products <- c("LF2020_ASP", "LF2020_ELEV", "LF2022_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","LF2020_ELEV","lt",500), c("change", "LF2022_CC", "st", 181)) save_file <- tempfile(fileext = ".zip") resp <- landfireAPI(products, aoi, projection, resolution, edit_rule = edit_rule, path = save_file) ## End(Not run)
landfireAPIv2 downloads LANDFIRE data by calling the LFPS API
landfireAPIv2( products, aoi, email, projection = NULL, resolution = NULL, edit_rule = NULL, edit_mask = NULL, priority_code = NULL, path = NULL, max_time = 10000, method = "curl", verbose = TRUE, background = FALSE, execute = TRUE )landfireAPIv2( products, aoi, email, projection = NULL, resolution = NULL, edit_rule = NULL, edit_mask = NULL, priority_code = NULL, path = NULL, max_time = 10000, method = "curl", verbose = TRUE, background = FALSE, execute = TRUE )
products |
Product names as character vector (see: Products Table) |
aoi |
Area of interest as character or numeric vector defined by
latitude and longitude in decimal degrees in WGS84 and ordered
|
email |
Email address as character string. This is a required argument
for the LFPS v2 API. See the LFPS Guide
for more information. Outside of the LFPS API request, this email address
is not used for any other purpose, stored, or shared by |
projection |
Optional. A numeric value of the WKID for the output projection Default is a localized Albers projection. |
resolution |
Optional. A numeric value between 30-9999 specifying the resample resolution in meters. Default is 30m. |
edit_rule |
Optional. A list of character vectors ordered "operator class" "product", "operator", "value" where "operator class" is one of "condition", "ORcondition", or "change". Edits are limited to fuel theme products only. (see: LFPS Guide) |
edit_mask |
Optional. Path to a compressed shapefile (.zip) to be used as an edit mask. The shapefile must be less than 1MB in size and must comply with ESRI shapefile naming rules. |
priority_code |
Optional. Priority code for wildland fire systems/users. Contact the LANDFIRE help desk for information ([email protected]) |
path |
Path to |
max_time |
Maximum time, in seconds, to wait for job to be completed. |
method |
Passed to |
verbose |
If FALSE suppress all status messages |
background |
If TRUE, the function will return immediately and the job
will run in the background. User will need to check the status of the job
manually with |
execute |
If FALSE, the function will build a request without submitting it to the LFPS API. |
Returns a landfire_api object with named elements:
request - list with elements query, date, url, job_id, request,dwl_url
content - Informative messages passed from API
response - Full response
status - Final API status, one of "Failed", "Succeeded", or "Timed out"
time - time of job completion
path - path to save directory
## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]" projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","LF2016_EVT","ne", 7054), c("change", "LF2016_CC", "st", 0)) save_file <- tempfile(fileext = ".zip") resp <- landfireAPIv2(products, aoi, email, projection, resolution, edit_rule = edit_rule, path = save_file) ## End(Not run)## Not run: products <- c("LF2016_EVT", "LF2016_CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") email <- "[email protected]" projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","LF2016_EVT","ne", 7054), c("change", "LF2016_CC", "st", 0)) save_file <- tempfile(fileext = ".zip") resp <- landfireAPIv2(products, aoi, email, projection, resolution, edit_rule = edit_rule, path = save_file) ## End(Not run)
virtual file system
landfire_vsi() opens a request LANDFIRE GeoTIFF using the GDAL virtual file system (VSI).
landfireVSI(landfire_api)landfireVSI(landfire_api)
landfire_api |
A |
The GDAL virtual file system allows you to read in LANDFIRE products without having to download the file to your local machine within 60 minutes of the request or if the file already exists on your local machine without having to unzip it.
SpatRaster object of the requested LANDFIRE product/s
## Not run: aoi <- c("-113.79", "42.148", "-113.56", "42.29") email <- "email@example" rast <- landfireAPIv2(products = "LF2016_EVT", aoi = aoi, email = email, method = "none") |> landfireVSI() ## End(Not run)## Not run: aoi <- c("-113.79", "42.148", "-113.56", "42.29") email <- "email@example" rast <- landfireAPIv2(products = "LF2016_EVT", aoi = aoi, email = email, method = "none") |> landfireVSI() ## End(Not run)
viewProducts() opens the LFPS products table in your web browser
viewProducts()viewProducts()
NULL. Opens the LF products table in your default browser.
## Not run: viewProducts() ## End(Not run)## Not run: viewProducts() ## End(Not run)