Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

grid_density

Map the pulse or point density


Description

Creates a map of the point density. If a "pulseID" attribute is found, also returns a map of the pulse density.

Usage

grid_density(las, res = 4)

Arguments

las

An object of class LAS or LAScatalog.

res

numeric. The size of a grid cell in LiDAR data coordinates units. Default is 4 = 16 square meters.

Value

A RasterLayer or a RasterBrick containing a numeric value in each cell. If the RasterLayers are written on disk when running the function with a LAScatalog, a virtual raster mosaic is returned (see gdalbuildvrt)

Working with a LAScatalog

This section appears in each function that supports a LAScatalog as input.

In lidR when the input of a function is a LAScatalog the function uses the LAScatalog processing engine. The user can modify the engine options using the available options. A careful reading of the engine documentation is recommended before processing LAScatalogs. Each lidR function should come with a section that documents the supported engine options.

The LAScatalog engine supports .lax files that significantly improve the computation speed of spatial queries using a spatial index. Users should really take advantage a .lax files, but this is not mandatory.

Supported processing options

Supported processing options for a LAScatalog in grid_* functions (in bold). For more details see the LAScatalog engine documentation:

  • chunk size: How much data is loaded at once. The chunk size may be slightly modified internally to ensure a strict continuous wall-to-wall output even when chunk size is equal to 0 (processing by file).

  • chunk buffer: This function guarantees a strict continuous wall-to-wall output. The buffer option is not considered.

  • chunk alignment: Align the processed chunks. The alignment may be slightly modified internally to ensure a strict continuous wall-to-wall output.

  • progress: Displays a progress estimate.

  • output files: Return the output in R or write each cluster's output in a file. Supported templates are {XLEFT}, {XRIGHT}, {YBOTTOM}, {YTOP}, {XCENTER}, {YCENTER} {ID} and, if chunk size is equal to 0 (processing by file), {ORIGINALFILENAME}.

  • select: The grid_* functions usually 'know' what should be loaded and this option is not considered. In grid_metrics this option is respected.

  • filter: Read only the points of interest.

Examples

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile,  filter = "-inside 684800 5017800 684900 5017900")

d <- grid_density(las, 5)
plot(d)

las <- retrieve_pulses(las)
d <- grid_density(las)
plot(d)

lidR

Airborne LiDAR Data Manipulation and Visualization for Forestry Applications

v3.1.2
GPL-3
Authors
Jean-Romain Roussel [aut, cre, cph], David Auty [aut, ctb] (Reviews the documentation), Florian De Boissieu [ctb] (Fixed bugs and improved catalog features), Andrew Sánchez Meador [ctb] (Implemented wing2015() for segment_snags()), Bourdon Jean-François [ctb] (Contributed to Roussel2020() for track_sensor()), Gatziolis Demetrios [ctb] (Implemented Gatziolis2019() for track_sensor())
Initial release
2021-03-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.