terrainr (version 0.3.1)

get_tiles: A user-friendly way to get USGS National Map data tiles for an area

Description

This function splits the area contained within a bounding box into a set of tiles, and retrieves data from the USGS National map for each tile.

Usage

get_tiles(
  data,
  output_prefix = tempfile(),
  side_length = NULL,
  resolution = 1,
  services = "elevation",
  verbose = FALSE,
  georeference = TRUE,
  ...
)

# S3 method for sf get_tiles( data, output_prefix = tempfile(), side_length = NULL, resolution = 1, services = "elevation", verbose = FALSE, georeference = TRUE, ... )

# S3 method for sfc get_tiles( data, output_prefix = tempfile(), side_length = NULL, resolution = 1, services = "elevation", verbose = FALSE, georeference = TRUE, ... )

# S3 method for Raster get_tiles( data, output_prefix = tempfile(), side_length = NULL, resolution = 1, services = "elevation", verbose = FALSE, georeference = TRUE, ... )

# S3 method for list get_tiles( data, output_prefix = tempfile(), side_length = NULL, resolution = 1, services = "elevation", verbose = FALSE, georeference = TRUE, ... )

# S3 method for terrainr_bounding_box get_tiles( data, output_prefix = tempfile(), side_length = NULL, resolution = 1, services = "elevation", verbose = FALSE, georeference = TRUE, ... )

Value

A list of the same length as the number of unique services requested, containing named vectors of where data files were saved to. Returned invisibly.

Available Datasources

The following services are currently available (with short codes in parentheses where applicable). See links for API documentation.

* [3DEPElevation](https://elevation.nationalmap.gov/arcgis/rest/services/3DEPElevation/ImageServer) (short code: elevation) * [USGSNAIPPlus](https://services.nationalmap.gov/arcgis/rest/services/USGSNAIPPlus/MapServer) (short code: ortho) * [nhd](https://hydro.nationalmap.gov/arcgis/rest/services/nhd/MapServer) (short code: hydro) * [govunits](https://carto.nationalmap.gov/arcgis/rest/services/govunits/MapServer) * [contours](https://carto.nationalmap.gov/arcgis/rest/services/contours/MapServer) * [geonames](https://carto.nationalmap.gov/arcgis/rest/services/geonames/MapServer) * [NHDPlus_HR](https://hydro.nationalmap.gov/arcgis/rest/services/NHDPlus_HR/MapServer) * [structures](https://carto.nationalmap.gov/arcgis/rest/services/structures/MapServer) * [transportation](https://carto.nationalmap.gov/arcgis/rest/services/transportation/MapServer) * [wbd](https://hydro.nationalmap.gov/arcgis/rest/services/wbd/MapServer) ("short code": watersheds)

Additional Arguments

The `...` argument can be used to pass additional arguments to the National Map API or to edit the hard-coded defaults used by this function. More information on common arguments to change can be found in [hit_national_map_api]. Note that `...` can also be used to change the formats returned by the server, but that doing so while using this function will likely cause the function to error (or corrupt the output data). To download files in different formats, use [hit_national_map_api].

See Also

Other data retrieval functions: hit_national_map_api()

Examples

Run this code
# NOT RUN {
simulated_data <- data.frame(
  id = seq(1, 100, 1),
  lat = runif(100, 44.04905, 44.17609),
  lng = runif(100, -74.01188, -73.83493)
)

simulated_data <- sf::st_as_sf(simulated_data, coords = c("lng", "lat"))

get_tiles(simulated_data, tempfile())
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab