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/index.php>) Product Service ('LFPS') API. |
Authors: | Mark Buckner [aut, cre, cph] |
Maintainer: | Mark Buckner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0.9000 |
Built: | 2025-03-08 02:14:54 UTC |
Source: | https://github.com/bcknr/rlandfire |
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)
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("ASP2020", "ELEV2020", "140CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","ELEV2020","lt",500), c("change", "140CC", "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("ASP2020", "ELEV2020", "140CC") aoi <- c("-123.7835", "41.7534", "-123.6352", "41.8042") projection <- 6414 resolution <- 90 edit_rule <- list(c("condition","ELEV2020","lt",500), c("change", "140CC", "st", 181)) save_file <- tempfile(fileext = ".zip") resp <- landfireAPI(products, aoi, projection, resolution, edit_rule = edit_rule, path = save_file) ## 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.
viewProducts()
viewProducts()