Learn R Programming

uavRst (version 0.5-2)

r_in_lidar: wraps the r.in.lidar tool

Description

simple wrapper for 'r.in.lidar' to calculate LiDAR derived raster grids. It creates a raster* object.

Usage

r_in_lidar(input = NULL, output = NULL, file = NULL, method = NULL,
  type = NULL, base_raster = NULL, zrange = NULL, zscale = NULL,
  intensity_range = NULL, intensity_scale = NULL, percent = NULL,
  pth = NULL, trim = NULL, resolution = NULL, return_filter = NULL,
  class_filter = NULL, flags = c("e", "n", "overwrite", "o"))

Arguments

input

input

output

output

file

file

method

method

type

type

base_raster

base_raster

zrange

zrange

zscale

zscale

intensity_range

intensity_range

intensity_scale

intensity_scale

percent

percent

pth

pth

trim

trim

resolution

resolution

return_filter

return_filter

class_filter

class filter

flags

flags

r.in.lidar

[-penosgijdv]

See Also

r.in.lidar help

Examples

Run this code
# NOT RUN {
require(uavRst)
##- Straightforward example to generate a DTM 
    based on the class 2 minimum returns of a LiDAR file
    
# get a las file from the Spain authorithy (29.2 MB)
# Source: (https://b5m.gipuzkoa.eus/url5000/es/G_22485/PUBLI&consulta=HAZLIDAR)
utils::download.file(url="https://b5m.gipuzkoa.eus/lidar/MT13_08_au_las.zip",
                           destfile="MT13_08_au_las.zip", mode = "wb")
unzip("MT13_08_au_las.zip",junkpaths = TRUE,overwrite = TRUE)

##- extract extent for setting up GRASS region
ext<-lastool(lasFile =  "MT13_08_au.las")
## according to the meta data 
#  source: https://b5m.gipuzkoa.eus/web5000/en/csw/MT13_08_au_en 
#  the projection is EPSG25830. NOTE it is obligate to at the zero transformation params
proj4 = "+proj=utm +zone=30 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

##- set up GRASS
result<-link2GI::linkGRASS7(spatial_params = c(ext[2],ext[1],ext[4],ext[3],proj4),
                             resolution = 5.0)
                             
##- use the r.in.lidar tool to generate a pseudo surface model
r_in_lidar(input = "MT13_08_au.las",
           output = "dem",
           method = "min",
           resolution = 5,
           class_filter = 2)
           
##- visualize it
raster::plot(raster::raster(rgrass7::readRAST("dem")))
                            
# }

Run the code above in your browser using DataLab