# dsmSearch

#### Xiaohao Yang

#### 1/26/2024

## 1. Get DSM raster data

    data <- dsmSearch::get_dsm_30(bbox = c(-83.783557,42.241833,-83.696525,42.310420), key = "Your KEY")

## 2. Get LiDAR data

### 2.1 Get LiDAR data information via API

    # search for lidar data information using bbox
    search_result <- dsmSearch::lidar_search(bbox = c(-83.742282,
                                                      42.273389,
                                                      -83.733442,
                                                      42.278724),
                                             preview = FALSE)
    search_result

### 2.2 Download LiDAR data with a given point and searching distance

    # try coordinates -83.741289,42.270146 (in south Michigan, USA)
    # radius is 1000ft
    las <- dsmSearch::get_lidar(x = -83.741289,
                                y = 42.270146,
                                r = 1000,
                                epsg = 2253)
    # download with bbox
    las <- dsmSearch::get_lidar(bbox = c(-83.742282,42.273389,-83.733442,42.278724),
                                epsg = 2253)

    # Create DTM
    dtm_ <- lidR::rasterize_terrain(las, res = 5, lidR::tin())
    terra::plot(dtm_)

    # Create DSM
    dsm_ <- lidR::rasterize_canopy(las, res = 5, lidR::dsmtin())
    raster::plot(dsm_)

For more usages of lidR please refer: https://github.com/r-lidar/lidR/tree/master and https://rpubs.com/jesseast/lidR4smarties