Downloads building footprints and attribute data from FEMA's USA Structures dataset (https://fema.maps.arcgis.com/home/item.html?id=0ec8512ad21e4bb987d7e848d14e7e24#overview).
download_buildings( template, return = "SpatVector", output = tempfile(fileext = ".gpkg") )
download_buildings( template, return = "SpatVector", output = tempfile(fileext = ".gpkg") )
template |
A SpatRaster object. The extent of the returned object will match |
return |
A character object, either |
output |
A character file path specifying where the |
A SpatVector
or sf
object with extents matching the SpatRaster
object provided in the template
argument. If API resources are not available an invisible NULL
is returned.
## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) buildings <- download_buildings(template = dem)
## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) buildings <- download_buildings(template = dem)
Downloads U.S. Census block boundaries and associated information for blocks within the spatial extent of the template SpatRaster.
download_census_blocks( template, year = "2020", page_size = NULL, output = tempfile(fileext = ".gpkg") )
download_census_blocks( template, year = "2020", page_size = NULL, output = tempfile(fileext = ".gpkg") )
template |
A SpatRaster object. |
year |
A character value. Any of the following values should work: |
page_size |
a numeric value passed to |
output |
A character file path specifying where the raster file should be stored. Defaults to a temporary file. |
A terra SpatVector object. If API resources are not available an invisible NULL
is returned.
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) blocks <- download_census_blocks(template = dem) blocks
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) blocks <- download_census_blocks(template = dem) blocks
Shortcut function that downloads and extracts TIGER U.S. County boundaries and returns them as a terra SpatVector object.
download_counties(template, output = tempfile(fileext = ".gpkg"))
download_counties(template, output = tempfile(fileext = ".gpkg"))
template |
A SpatRaster object. |
output |
A character file path specifying where the raster file should be stored. Defaults to a temporary file. |
A terra SpatVector object. If API resources are not available an invisible NULL
is returned.
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) counties <- download_counties(template = dem)
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) counties <- download_counties(template = dem)
Provides a wrapper to rnassqs::nassqs()
with simplified arguments
for making queries that return county level livestock estimates. This
function requires an API key from USDA NASS Quickstats. See details for
more information.
download_nass_livestock( state_alpha = NULL, county_name = NULL, year = "2022", ... )
download_nass_livestock( state_alpha = NULL, county_name = NULL, year = "2022", ... )
state_alpha |
Two letter character abbreviation for state. |
county_name |
Character, county name. |
year |
A character to filter the NASS Agriculture Census year. Expects one of: |
... |
Additional arguments passed to |
This function requires an API key to make requests on the USDA NASS QuickStats service.
Obtain an API key from https://quickstats.nass.usda.gov/api/.
Set the NASSQS_TOKEN
variable in your global environment. This can be done with Sys.setenv('NASSQS_TOKEN' = <your api key>)
, or usethis::edit_r_environment()
.
Restart your session.
A dataframe.
download_nass_livestock(state_alpha = "TX", county_name = "Brazos", year = "2022")
download_nass_livestock(state_alpha = "TX", county_name = "Brazos", year = "2022")
Downloads and writes an NLCD SpatRaster to file with extents defined by template
. This function downloads the annualized NLCD data products. See https://www.mrlc.gov/data/project/annual-nlcd for more information.
download_nlcd( template, year = "2021", dataset = "LndCov", landmass = "CU", output = tempfile(fileext = ".tiff"), overwrite = FALSE, verbose = FALSE, ... )
download_nlcd( template, year = "2021", dataset = "LndCov", landmass = "CU", output = tempfile(fileext = ".tiff"), overwrite = FALSE, verbose = FALSE, ... )
template |
A SpatRaster object defining the spatial extent of the returned NLCD raster. |
year |
character, expects a value between |
dataset |
Character. Expects |
landmass |
Character, one of: |
output |
A character file path specifying where the raster file should be stored. Defaults to a temporary file. |
overwrite |
logical. If |
verbose |
Logical, if |
... |
additional arguments for for writing files, see |
A SpatRaster object with file written to output
Downloads NPDES permits from EPA ECHO API services within the bounds of the SpatRast template.
download_NPDES_permits( template, permit_component = "POT", permit_status = "EFF", output = tempfile(fileext = ".gpkg") )
download_NPDES_permits( template, permit_component = "POT", permit_status = "EFF", output = tempfile(fileext = ".gpkg") )
template |
A SpatRaster object. |
permit_component |
A character vector with one or more of the following: |
permit_status |
A character vector with one or more of the following: |
output |
A character file path specifying where the raster file should be stored. Defaults to a temporary file. |
SpatVector object
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) download_NPDES_permits(dem)
dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) download_NPDES_permits(dem)
Downloads a U.S. Census designated urban areas intersecting the spatial extent of the template SpatRaster.
download_urban_areas( template, page_size = NULL, output = tempfile(fileext = ".gpkg") )
download_urban_areas( template, page_size = NULL, output = tempfile(fileext = ".gpkg") )
template |
A SpatRaster object. |
page_size |
a numeric value passed to |
output |
A character file path specifying where the |
A terra SpatVector object. If API resources are not available an invisible NULL
is returned.
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) ua <- download_urban_areas(template = dem) ua
# example code ## This example requires an internet connection to run dem <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") dem <- terra::rast(dem) ua <- download_urban_areas(template = dem) ua
Checks if a NASS token has been set in the user environment.
has_nass_token()
has_nass_token()
logical
has_nass_token()
has_nass_token()
A convenience functions for simultaneously setting the GDAL runtime configuration options in both terra and gdalraster.
set_gdal_config(option, value)
set_gdal_config(option, value)
option |
Character name of a configuration option. |
value |
Character value to set for the option. |
No return value, called for side effects.
terra::setGDALconfig()
and gdalraster::set_config_option()
set_gdal_config("GDAL_CACHEMAX", "10%") ## unset set_gdal_config("GDAL_CACHEMAX", "")
set_gdal_config("GDAL_CACHEMAX", "10%") ## unset set_gdal_config("GDAL_CACHEMAX", "")
Elevation raster of the Thompsons Creek watershed outside of College Station, Texas. This data is obtained from the hydroreinforced digital elevation model (DEM) rasters that are part of the United States Geological Survey (USGS) and United States Environmental Protection Agency (EPA) National Hydrography Dataset Plus (NHDPlus).
https://nhdplus.com/NHDPlus/NHDPlusV2_home.php
thompson <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") terra::rast(thompson)
thompson <- system.file("extdata", "thompsoncreek.tif", package = "SELECTRdata") terra::rast(thompson)
Polygon boundary of the Thompsons Creek watershed (Collecge Station, Texas). This watershed boundary was created using the hydroreinformced raster from the United States Geological Survey (USGS) and United States Environmental Protection Agency (EPA) National Hydrography Dataset Plus (NHDPlus) dataset.
gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata") terra::vect(gpkg, layer = "wbd")
gpkg <- system.file("extdata", "thompsoncreek.gpkg", package = "SELECTRdata") terra::vect(gpkg, layer = "wbd")