Learn R Programming

lidR (version 2.2.5)

catalog_retile: Retile a LAScatalog

Description

Splits or merges files to reshape the original catalog files (.las or .laz) into smaller or larger files. It also enables the addition or removal of a buffer around the tiles. The function first displays the layout of the new tiling pattern and then asks the user to validate the command. Internally, the function reads and writes the clusters defined by the internal processing options of a LAScatalog processing engine. Thus, the function is flexible and enables the user to retile the dataset, retile while adding or removing a buffer (negative buffers are allowed), or optionally to compress the data by retiling without changing the pattern but by changing the format (las/laz). Note that this function is not actually very useful since lidR manages everything (clipping, processing, buffering, ...) internally using the proper options. Thus, retiling may be useful for working in other software, for example, but not in lidR.

Usage

catalog_retile(ctg)

Arguments

ctg

A LAScatalog object

Value

A new LAScatalog object

Working with a <code>LAScatalog</code>

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 bold). For more details see the LAScatalog engine documentation:

  • chunk_size: Size of the new tiles.

  • buffer: Load new tiles with a buffer. The expected value is usually 0.

  • alignment: Alignment of the new tiles.

  • cores: The number of cores used. catalog_retile streams the data (nothing is loaded at th R level). The maximum number of cores can be safely used.

  • progress: Displays a progress estimation.

  • output_files*: Mandatory. The new tiles will be written in new files.

  • laz_compression: save las or laz files.

  • select: catalog_retile preserve the file format anyway.

  • filter: Retile and save only the points of interest.

Examples

Run this code
# NOT RUN {
ctg = readLAScatalog("path/to/catalog")

# Create a new set of .las files 500 x 500 wide in the folder
# path/to/new/catalog/ and iteratively named Forest_1.las, Forest_2.las
# Forest_3.las, and so on.

opt_chunk_buffer(ctg) <- 0
opt_chunk_size(ctg) <- 500
opt_output_files(ctg) <- "path/to/new/catalog/Forest_{ID}
newctg = catalog_retile(ctg)

# Create a new set of .las files equivalent to the original,
# but extended with a 50 m buffer in the folder path/to/new/catalog/
# and iteratively named named after the original files.

opt_chunk_buffer(ctg) <- 50
opt_chunk_size(ctg) <- 0
opt_output_files(ctg) <- "path/to/new/catalog/{ORIGINALFILENAME}_buffered
newctg = catalog_retile(ctg)

# Create a new set of compressed .laz file equivalent to the original, keeping only
# first returns above 2 m

opt_chunk_buffer(ctg) <- 0
opt_chunk_size(ctg) <- 0
opt_laz_compression(ctg) <- TRUE
opt_filter(ctg) <- "-keep_first -drop_z_below 2"
newctg = catalog_retile(ctg)
# }

Run the code above in your browser using DataLab