Skip to content

How the LiDAR Tools Tile a Point Cloud

Ground classification, DTM, normalization, CHM/DSM and hummock/hollow split large point clouds into square tiles. Each tile must fit in one R worker's memory, so tile sizes follow the point density: 500 m where the data is sparse, down to 100 m where it's dense. See How the PC2Products Tools Run for the tiling and skip_existing options. Tile LiDAR Data cuts the same tiles ahead of time and writes them to a folder, for the tools to process by file.

From files to tiles

Before any points are read, the tool plans the tiles from the point counts stored in each file's .lax spatial index. The plan takes about 2 seconds for the 276 Real_Lidar files.

flowchart LR
    A["LAS/LAZ files<br/>+ .lax index<br/>(point counts)"] --> B["50 m<br/>density grid"]
    B --> C["500 m blocks<br/>each gets the largest<br/>tile size that fits"]
    C --> D["One lidR run per size<br/>500 → 250 → 125 → 100 m<br/>workers in parallel"]
    D --> E["Tile outputs<br/>named by corner"]
    D --> F["tiles_&lt;suffix&gt;.csv<br/>the plan, for resuming"]

Each 500 m block gets one tile size

The data is divided into 500 m blocks aligned to the coordinate grid at 0, 0. For each block the planner tries 500 m first, then 250, 125 and 100 m, and keeps the largest size whose densest tile still fits in a worker's memory. All four sizes divide 500 m evenly, so the tiles of a block fill it exactly, and blocks of different sizes sit side by side without gaps or overlap.

Four 500 m blocks split into 1, 4, 16 and 25 tiles

Every tile reads a buffer around it

A tile is processed with a buffer of points around it, so results don't break at the tile edge. Ground classification uses 20 m and the other tools 30 m. The buffer comes from neighbouring tiles, and from other files when the tile is near a file edge; the .lax index lets the tool read just that strip. After processing, the buffer is dropped and only the tile itself is written. Small tiles read proportionally more buffer, which is why the planner uses the largest size that fits.

A 100 m tile with a 20 m buffer, and points read per point kept for each tile size

Tile size Points read per point kept, 20 m buffer 30 m buffer
500 m 1.17 1.25
250 m 1.35 1.54
125 m 1.74 2.19
100 m 1.96 2.56

Real_Lidar at 11.5 GB free memory

This is the plan the tool makes for the 276 Real_Lidar files (11.5 billion points, EPSG:2956) with 11.5 GB free and ground classification's 20 m buffer. Sparse edges get 500 m tiles, while the dense centre needs 125 m and, in two blocks, 100 m tiles.

Real_Lidar 500 m blocks coloured by tile size

Tile size Blocks Densest tile with its buffer
500 m 85 144.6 million points
250 m 39 60.4 million points
125 m 162 22.1 million points
100 m 2 16.3 million points

One worker has room for about 21.5 million points. The densest 125 m tile holds 22.1 million points with its buffer, so the two densest blocks drop to 100 m. With the buffers, the run reads about 19.5 billion points to classify 11.5 billion.

More workers means smaller tiles

The free memory is shared between the workers, so each extra worker leaves less room per worker and forces smaller tiles, which read more buffer. The planner tries every worker count and picks the one where each worker reads the fewest points. A tile too dense for that many workers, even at 100 m, doesn't stop it: such tiles are processed after the others in a round with fewer workers, and the estimate counts that round's time (its points shared out between its workers, and no less than its largest tile). These figures are for Real_Lidar, where every tile fits:

Points read per worker for 1 to 4 workers at 11.5, 20 and 32 GB free

Free memory 1 worker 2 workers 3 workers 4 workers
11.5 GB 19.5 doesn't fit doesn't fit doesn't fit
20 GB 16.8 10.1 doesn't fit doesn't fit
32 GB 14.6 9.1 6.6 doesn't fit

Billions of points each worker reads, buffers included; the chosen plan is in bold. Each worker has 60% of the free memory divided by the number of workers, minus 1.6 GB for the R session (and 0.21 GB per thread after the first), at the bytes per point measured for each tool: 260 for ground classification here, up to 850 for the pit-free CHM/DSM (see Tiling), so the tools that need more per point get smaller tiles. More memory therefore buys larger tiles first, then more workers.

Running and resuming

lidR needs one tile size per run, so the tool runs once for each size in the plan. Before each run it prints R_TILES:<done>:<total>, which the GUI uses to count tiles across all runs. If a tile fails (for example with std::bad_alloc when memory runs out), the tool stops and names the tile. Running it again with skip_existing set to true reloads the saved plan, skips every tile whose output is complete, and starts at the failed one.

A first run stops at a failed tile; the rerun skips the finished tiles and continues

  • A file the stopped run was writing is made again: each output is written as <name>.partial.<ext> and renamed when complete, and the next run removes the .partial files.
  • The plan lists one row per block: bx, by, size. Tiles are named by their lower-left corner, for example 520250_6228125_csfgnd_upto30cm_cloth150cm_hard.las.
  • The raster tools merge the skipped tiles with the new ones into one Merged_*.tif.
  • Resume only with the same parameters. Output names don't record every parameter, the DTM cell size for one.