terrainr (version 0.3.1)

hit_national_map_api: Hit the USGS 3DEP API and retrieve an elevation heightmap

Description

This function retrieves a single tile of data from a single National Map service and returns the raw response. End users are recommended to use get_tiles instead, as it does much more validation and provides a more friendly interface. For a description of the datasets provided by the National Map, see https://apps.nationalmap.gov/services

Usage

hit_national_map_api(
  bbox,
  img_width,
  img_height,
  service,
  verbose = FALSE,
  ...
)

Value

A raw vector.

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. Some of the most useful options that can be changed include:

  • bboxSR: The spatial reference of the bounding box given to this function. If not specified, assumed to be 4326.

  • imageSR: The spatial reference of the image downloaded. If not specified, assumed to be 4326.

  • layers: Which data layers to download. If the National Map API returns data without specifying layers, this argument isn't used by default. When the National Map requires this argument, the default value is 0.

  • format: The image format to be downloaded. Defaults depend on the service being used and are set to be compatible with get_tiles.

Pass these arguments to hit_national_map_api like you would any other argument to substitute new values. Note that ... values are never validated before being used; passing invalid parameters to ... will cause data retrieval to fail.

See Also

get_tiles for a friendlier interface to the National Map API.

Other data retrieval functions: get_tiles()

Examples

Run this code
# NOT RUN {
hit_national_map_api(
  bbox = list(
    c(lat = 44.10438, lng = -74.01231),
    c(lat = 44.17633, lng = -73.91224)
  ),
  img_width = 8000,
  img_height = 8000,
  service = "3DEPElevation"
)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab