Type: Package
Title: DSM and LiDAR downloader
Version: 1.2.1
Description: A collection of functions to search and donwload DSM (Digital Surface Model) and LiDAR (Light Detection and Ranging) data via APIs, including 'OpenTopography' https://portal.opentopography.org/apidocs/ and 'TNMAccess' https://apps.nationalmap.gov/tnmaccess/#/.
Depends: R (≥ 4.1)
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.3.1
Language: en-US
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
VignetteBuilder: knitr, rmarkdown
Imports: dplyr, sf, sp, terra, lidR, httr2, forestdata, nominatimlite, imager
NeedsCompilation: no
Packaged: 2025-06-05 21:03:57 UTC; yangxiaohao
Author: Xiaohao Yang [aut, cre, cph], Nathan Fox [aut], Derek Van Berkel [aut], Mark Lindquist [aut]
Maintainer: Xiaohao Yang <xiaohaoy@umich.edu>
Repository: CRAN
Date/Publication: 2025-06-05 21:40:02 UTC

get_dsm_30

Description

Search for and download Digital Surface Model based on coordinates of a spatial point with a given distance or bounding box. The resolution of AW3D30 (ALOS World 3D 30m) and SRTMGL1 (SRTM GL1 30m) raster is 30 meter. The raster resolutions of USGS datasets are 10m and 1m. Forest canopy height maps (CHM) include the ETH Global Sentinel-2 10m Canopy Height (2020) and the Meta High Resolution 1m Global Canopy Height Map

Usage

get_dsm_30(x, y, r, epsg, bbox, datatype = "AW3D30", key = "")

Arguments

x

numeric, indicating Longtitude degree of the center point. (bbox is specified, this argument is ignored)

y

numeric, indicating latitude degree of the center point. (bbox is specified, this argument is ignored)

r

numeric, indicating search distance (meter or feet) for LiDAR data. (bbox is specified, this argument is ignored)

epsg

numeric, the EPSG code specifying the coordinate reference system. (bbox is specified, this argument is ignored)

bbox

vector, a bounding box defining the geographical area for downloading data.

datatype

character, dataset names including "AW3D30", "SRTMGL1", "USGS1m", "USGS10m", "metaCHM", and "ethCHM".

key

character, API key of OpenTopography. (not required for "metaCHM", and "ethCHM")

Details

To request an API key of OpenTopography, online registeration is needed.

To get CHMs with more customized arguments please use fd_canopy_height from the forestdata package.

Data may be freely used for academic purposes, but be cited appropriately (see references below).

Value

SpatRaster raster

References

Japan Aerospace Exploration Agency (2021). ALOS World 3D 30 meter DEM. V3.2, Jan 2021. Distributed by OpenTopography. https://doi.org/10.5069/G94M92HB. Accessed: 2025-06-04

United States Geological Survey (2021). United States Geological Survey 3D Elevation Program 1 meter Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G9NP22NT. Accessed: 2025-06-04

United States Geological Survey (2021). United States Geological Survey 3D Elevation Program 1/3 arc-second Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G98K778D. Accessed: 2025-06-04

United States Geological Survey (2021). United States Geological Survey 3D Elevation Program 1 arc-second Digital Elevation Model. Distributed by OpenTopography. https://doi.org/10.5069/G9HX19WN. Accessed: 2025-06-04

Lang, Nico, Walter Jetz, Konrad Schindler, and Jan Dirk Wegner. "A high-resolution canopy height model of the Earth." arXiv preprint arXiv:2204.08322 (2022).

Tolan, J., Yang, H.I., Nosarzewski, B., Couairon, G., Vo, H.V., Brandt, J., Spore, J., Majumdar, S. , Haziza, D., Vamaraju, J. and Moutakanni, T., 2024. Very high resolution canopy height maps from RGB imagery using self-supervised vision transformer and convolutional decoder trained on aerial lidar. Remote Sensing of Environment, 300, p.113888.

Examples

## Not run: 
data <- dsmSearch::get_dsm_30(bbox = c(-83.783557,42.241833,-83.696525,42.310420),
                              key = "API key")
data <- dsmSearch::get_dsm_30(x = -83.741289,
                              y = 42.270146,
                              r = 1000,
                              epsg = 2253,
                              key = "API key")

## End(Not run)


get_lidar

Description

Search for and download LiDAR data based on coordinates of a spatial point with a given distance or a bounding box. The maximum distance is 1000m. Different dataset could be found and the function automatically downloads the latest dataset. To get more details of data on a larger scale, please use viewscape::lidar_search.

Usage

get_lidar(x, y, r, epsg, bbox, max_return = 1000, folder)

Arguments

x

numeric, indicating Longtitude degree of the center point.

y

numeric, indicating latitude degree of the center point.

r

numeric, indicating search distance for LiDAR data. The maximum distance is 1000m (3281ft). If r > 1000m, it will be reset to 1000m.

epsg

numeric, the EPSG code specifying the coordinate reference system.

bbox

vector, a bounding box defining the geographical area for downloading data.

max_return

numeric, indicating the maximum of returns.

folder

string (optional), indicating a path for downloading the LiDAR data

Value

lidR LAS object.

References

Jean-Romain Roussel and David Auty (2022). Airborne LiDAR Data Manipulation and Visualization for Forestry Applications. R package version 4.0.1. https://cran.r-project.org/package=lidR

See Also

lidar_search()

Examples


las <- dsmSearch::get_lidar(x = -83.741289, y = 42.270146, r = 1000, epsg = 2253)
las <- dsmSearch::get_lidar(bbox = c(-83.742282,42.273389,-83.733442,42.278724), epsg = 2253)

if (inherits(las, "LAS")) {
  can <- lidR::rasterize_canopy(las, 10, lidR::dsmtin())
  terra::plot(can)
} else {
  message("No LAS object returned. Skipping rasterization.")
}



Description

The lidar_search function is designed to facilitate the retrieval and exploration of LiDAR (Light Detection and Ranging) data within a specified bounding box (bbox). This function enables users to search for LiDAR data, preview available graphics, and optionally download LiDAR data files for further analysis.

Usage

lidar_search(bbox, max_return = 500, preview = FALSE, folder = "")

Arguments

bbox

vector, a bounding box defining the geographical area for the LiDAR data search.

max_return

numeric, indicating the maximum of returns.

preview

logical. If TRUE (default is FALSE), enable or disable previewing LiDAR graphics.

folder

string (optional), indicating an optional folder path where downloaded LiDAR data files will be saved.

Value

dataframe

Note

The lidar_search function simplifies the process of searching for and working with LiDAR data via the TNMAccess API: https://tnmaccess.nationalmap.gov/api/v1/docs.

Examples


bbox <- c(-83.742282,42.273389,-83.733442,42.278724)
search_result <- dsmSearch::lidar_search(bbox = bbox,
                                         max_return = 25,
                                         preview = FALSE)