Questions tagged [lidr]

R package for Airborne LiDAR Data Manipulation and Visualization in Forestry Applications

Filter by
Sorted by
Tagged with
0 votes
2 answers
22 views

How to export an IDW DTM as a GeoTIFF file in R

I have loaded both raster and lidR packages within RStudio and I am trying to export the IDW DTM files but have been receiving errors about 'format'. I have exported a TIN DTM already however with IDW ...
Niall Gavin's user avatar
0 votes
1 answer
48 views

lidR canopy height map has holes/jagged edges

I am trying to create a canopy height map from LIDAR point cloud data (LAS format) but I get some jagged edges/holes in my results (see photo). Is there a parameter I can tweak to fill these in? I ...
Max Ogden's user avatar
  • 133
0 votes
1 answer
39 views

Normalizing LAScatalog only outputs one tile

I'm having trouble normalizing a LAScatalog. I wonder whether my methodology is flawed, or if something is possibly wrong with my dataset (a point cloud based on photogrammetry). When I try to ...
NateDogg123's user avatar
1 vote
1 answer
20 views

How to fill pits for a DEM/CHM when using the LAScatalog engine?

I'm trying to create a DEM/CHM using the LAScatalog engine. I've followed the steps in the lidRbook. In chapter 6 section 6.4 the post processing fills in areas no missing values for single las files ...
Walshe_d's user avatar
  • 590
0 votes
0 answers
27 views

Create a buffer on a single LAS file using lidR

I want to create a buffer for a single LAS file in order to test different algorithims for DTM creation on a small scale before scaling up to all my files using LAScatalog. I know LAScatalog creates a ...
Walshe_d's user avatar
  • 590
0 votes
1 answer
15 views

lidR pixel_metrics returning incorrect results with LAScatalog [closed]

This code seems to work correctly when I use it with a single las file f <- function(x) { # user-defined fucntion list(mean = mean(x), sd = sd(x)) } las <- readLAS(<path to las file>) ...
Sam H's user avatar
  • 1
0 votes
0 answers
15 views

Interactively re-center a lidR plot

Is it possible to move the plot center of a lidR plot from within the plot visualization? For example, I try dragging and using up and down arrows, but it does not move the point cloud's position ...
ENIAC-6's user avatar
  • 790
0 votes
1 answer
34 views

R LidR Package readlas function with extra features limitations

I'm encountering an issue while working with LAS data generated from the open-source software CloudCompare. I've exported 24 geometric features to a LAS file format(1.4), and I'm experiencing ...
Muzo583's user avatar
  • 61
0 votes
1 answer
25 views

How to calculate voxel metrics for a LAScatalog using lidR?

I'm trying to calculate metrics for a LAScatalog with the voxel_metrics function. This is the code I used: library(lidR) ctg <- readLAScatalog("laspath") voxel_metrics(ctg, ~mean(Z), 4) ...
user232510's user avatar
1 vote
1 answer
51 views

lidR producing error "$ operator not definied for this S4 class" when trying to apply function to lascatalog using catalog_apply

I am trying to write a function to calculate specific metrics which I can write to a data frame and then a .csv file to write 'reports' on each las file in a directory. I have tried the following code:...
Dr-JH-o'clock's user avatar
0 votes
0 answers
26 views

Can Z output from rasterize_terrain() be made numeric?

I'm updating code to compute height and elevation of tree tops derived from locate_trees(). To do this I also create a DTM from the LAS file. The older grid_terrain() produced a RasterLayer and the ...
Ray J's user avatar
  • 549
1 vote
1 answer
32 views

Iterating through las directory using lidR in R results in not finding file or not recognising file as .las

I am trying to produce a script which has functions that can produce a list of statistics and writes them to data.frame, which can in turn be written to a csv file if needed. This would be to check ...
Dr-JH-o'clock's user avatar
0 votes
1 answer
40 views

How do I use autocrop with a complex function for catalog_apply()?

In the case of a complex function, I would like to try the autocrop option, instead of crop inside the function, to resize output from catalog_apply() to the chunk size. In the code below, the ...
Ray J's user avatar
  • 549
1 vote
1 answer
16 views

How do I use autocrop in a function for catalog_apply()?

I would like to try the autocrop option, instead of crop inside the function, to resize output from catalog_apply() to the chunk size. In the code below, the commented-out code works, but the autocrop ...
Ray J's user avatar
  • 549
0 votes
1 answer
38 views

Plotting real (normalized) las values on dtm

I am trying to plot a las where I filtered objects, that have a first and a last return simultaneously (objects in the las file), onto a created dtm of the same las. I am able to produce a good result....
utz's user avatar
  • 3
0 votes
1 answer
31 views

lidR: What is "Area" in Cloud_metrics(.stdmetrics)? [closed]

I have plot locations and .las tiles. I have extracted the point clouds at each of the plots with a 15 meters radius. It means i now have as many .las files as i have plots. Then, in a for loop, for ...
Renaud Bied-charreton's user avatar
0 votes
0 answers
22 views

LAS files not identified in lidR

When I try to upload the las file to work on lidR package it give the following error. The code I used to upload the file las <-readLAS("<Sample.las>") Error in streamLAS.character(...
Dilshan Benaragama's user avatar
2 votes
1 answer
60 views

How do I overwrite files in the function pixel_metrics()?

I'm trying to test my pixel_metrics() custom function, and I'm not sure how to overwrite the old file, like the error message suggests in the screenshot. I have added overwrite=TRUE to my function ...
NateDogg123's user avatar
3 votes
1 answer
52 views

How do I run filter_poi() on a LAScatalog object?

I want to read a LAS catalog, create a DEM, normalize the catalog, and run filter_poi() on the catalog. My issue is that when I try to run filter_poi(), in the code below, I get the error "...
NateDogg123's user avatar
1 vote
1 answer
83 views

How can I export a lidR LAScatalog to a shapefile?

I would like to export a lascatalog to a shapefile. It could be done in the past with rgdal but this is being retired. The error is below. library(lidR) library(sf) ctg <- readLAScatalog(system....
Ray J's user avatar
  • 549
0 votes
0 answers
78 views

Euclidean distance point Cloud clustering in R lidR

I'm looking for a way to implement the python function filter.clusters from the pdal package in R using the lidR package. The function clusters pointclouds using the Euclidean distance, a tolerance ...
Eike's user avatar
  • 1
3 votes
1 answer
92 views

Classify vegetation by height

Trying to further classify a las catalog that already has buildings, bridges, noise and ground classified. I want to break the unassigned points into vegetation classes by height but can't get it to ...
pseudotsuga's user avatar
1 vote
1 answer
41 views

Create LAS v1.4 from scratch

I want to create a LAS object from scratch with number of returns up to 15 (according to LAS v1.4) like: data <- data.frame(X = runif(100, 0, 100), Y = runif(100, 0, 100), ...
BenBrede's user avatar
0 votes
0 answers
18 views

rasterize_terrain DTM raster file write error [duplicate]

I am trying to create DTM rasters from a list of LAS files. Code: # Create a LAS catalog LAS_List = readLAScatalog("path", recursive = TRUE) # Create an output destination to store the DTM ...
Arthur_Morgan's user avatar
0 votes
1 answer
68 views

Create one single DTM raster file from multiple LAS files

This question can be considered an extension of Create a DTM using the TIN algorithm I am providing multiple LAS files as a catalog list to the rasterize_terrain which breaks the LAS into smaller ...
Arthur_Morgan's user avatar
0 votes
0 answers
30 views

Unexpected artifacts when creating a digital terrain model (DTM) using lidR and gstat libraries in R

I'm using the lidR, raster, sp, and gstat libraries in R to create a Digital Terrain Model (DTM) from LiDAR data. I'm encountering unexpected artifacts in my DTM and I'm unsure why. Here is my code: ...
Purple_Ad's user avatar
1 vote
1 answer
58 views

Create a DTM using the TIN algorithm

I am trying to create a DTM on a county wide level (so using LAS catalog). The lidRworkbook advises to use a buffer when using the TIN method, however the workbook doesn't show how to do that. So how ...
Arthur_Morgan's user avatar
2 votes
1 answer
69 views

Calculate proportions of all returns, returns between a height interval

I want to calculate, for each pixel, the proportions of returns between 0.5 and 5 m height above ground, compared to the total return count I have figured out how to do it for the entire las file, but ...
BERA's user avatar
  • 68.8k
2 votes
2 answers
192 views

How can I crop a raster (within a function) that is used by catalog_apply() in lidR, using Terra instead of Raster?

I have older code to crop a chunk within a function (to avoid edge effects when later merging CHM tiles together (i.e., edge pixels derived without enough data. The extend of 1 is to avoid little gaps)...
Ray J's user avatar
  • 549
1 vote
1 answer
39 views

Classify Pointcloud using thematic layer with lidR

I want to use lidR to classify points within a point cloud using a few thematic shapefiles. This includes buildings, vegetation and cars. For this I use the classify_poi function, which works for ...
FelixB.'s user avatar
  • 109
1 vote
1 answer
27 views

How to harmonize catalog to target density

My original catalog: has a mean density of 2.2 points/m2, but some areas have a higher density. : > plot(lidR::grid_density(ctg, 1), main = "Density grid 1x1 m ", breaks = c(0,2,3,5,16), ...
candelas762's user avatar
2 votes
1 answer
72 views

negative or null values in custom function

I'm working with the package lidR (v 4.0.3) to extract the tree positions using a custom function but it behaves weirdly. If I use the following, I get an error: f = function(x) { 0.413 * x^0.5532 } ...
Nico's user avatar
  • 305
0 votes
0 answers
31 views

Why clip_roi function in lidR only work with SpatialPolygons and not SpatVector?

Most of the functions from lidR work using SpatVector and SpatRaster from terra package but I obtained this error using clip_roi function Error in clip_roi(ctg, Extent1) : Geometry type SpatVector not ...
Juan Guerra's user avatar
0 votes
1 answer
51 views

lidR, create table with numberofreturn by returnnumber in catalog

In a LAScatalog we can have the 5th first return, but how can i have this table if there is 7 return like this : With this code i can generate this table with 4 return : LASfile <- system.file(&...
Pascal Obstétar's user avatar
2 votes
1 answer
47 views

Memory efficient way of using clip_roi for bigger areas

I am trying to clip LAS files from a LAScatalog object based on a polygon boundary (sf object). However, since the area of interest is too big, the clip_roi function might eventually like mid way ...
Arthur_Morgan's user avatar
2 votes
1 answer
61 views

clip_roi dimension error

I am trying to clip LAS files from a catalog object based on a Polygon boundary (sf_object), however, I am getting the following error. What could be the issue and how can it be fixed? Error: ...
Arthur_Morgan's user avatar
1 vote
1 answer
36 views

lidR version 4.0.3 lasmetrics disappear and make error

Before lidR v4.0.3 this code return datatable but now lasmetrics is replaced with different part function. How can i transform this code in lidR v 4.0.3 ? LASfile <- system.file("extdata",...
Pascal Obstétar's user avatar
1 vote
1 answer
39 views

LidR catalog apply function not return dataframe

Here is my code : LASfile <- system.file("extdata", "Megaplot.laz", package="lidR") ctg = readLAScatalog(LASfile) myMetrics2 <- function(rnu, nor) { tab <- ...
Pascal Obstétar's user avatar
0 votes
1 answer
28 views

Pass the whole roi's cloud to use it in plot_metrics()?

I am trying to create a custom plot_metrics function that calculates a series of metrics from the Canopy Heigh Model (CHM) of the points clipped from a catalog. LASfile <- system.file("extdata&...
candelas762's user avatar
1 vote
1 answer
147 views

Tips for optimizing parallelism with lidR custom metric to be deployed on HPC [closed]

I've read the documentation on parallel computation in lidR in the lidR package documentation (page 73) and am a bit lost about how to optimize or effectively implement parallelism on a high-...
Jocelyn P.'s user avatar
5 votes
2 answers
607 views

Is there a major drawback of working with compressed LAZ vs. the uncompressed LAS?

Compressed LAS pointclouds (LAZ) are significantly smaller than the uncompressed ones (I observe a compression factor of x4 - x5). Since point clouds are often large files, this is a substantial ...
Honeybear's user avatar
  • 2,334
1 vote
1 answer
38 views

lidR custom grid metric returning raster output mean max values lower than 1 m for mean height bin interval between 0.2-4

I want to calculate the mean height of shrubs layer using the mean height of points between 0.2-4 m above ground but the raster output mean max values never is higher than 1 m which is not make sense ...
Juan Guerra's user avatar
0 votes
1 answer
54 views

lidR custom grid metric returning infinite values

I am trying to calculate the proportion of points 0.3-2.5m above ground relative to the number of ground points + all points up to 2.5m above ground using lidR grid_metrics(). My custom grid_metrics() ...
Jocelyn P.'s user avatar
2 votes
1 answer
332 views

How to efficiently reproject a LAS point cloud to EPSG:2056 (not known by LAStools)?

I have a large LAS pointcloud in LV03 (EPSG:21781) that I want to reproject to LV95 (EPSG:2056). My approaches so far bear no fruit. What is a good way to re-project LAS data to a different CRS (...
Honeybear's user avatar
  • 2,334
3 votes
2 answers
250 views

Why is laspy X,Y co-ordinate different to X,Y co-ordinate in lidr

I am working in both r and python to process lidar data with .las format. One thing I have noticed is that the x,y co-ordinate when working with laspy is different than x,y co-ordinate when using lidr....
Purple_Ad's user avatar
2 votes
0 answers
51 views

Can a function that lists various metrics be used in `plot_metrics()`

I'm trying to combine various metrics to use in plot_metrics(). But I get an error when I run it. I tried to follow the answer from here: How to incorporate stdmetrics in gridmetrics function? Can a ...
Ray J's user avatar
  • 549
3 votes
1 answer
96 views

lidR: How to configure opt_output_files() for chunk processing of multiple pixel_metrics()?

This is a somewhat conceptual question about how the opt_output_files() function works in lidR. I'm working on a project where I'm calculating a series of custom pixel metrics across a large spatial ...
Alex Goetz's user avatar
0 votes
1 answer
110 views

Clipping LAScatolog with a large polygon shapefile using is extremely slow

I´m using the lidR (Version 4.0.0) package to clip a LAScatalog (with 119 .las files, ~52.9 Gb) using a very large polygon shapefile (~865K buffers with 25m diameter each). I´m stuck in this task ...
Rui's user avatar
  • 9
1 vote
1 answer
134 views

Error in "writeOGR" When creating a shapefile from convex hulls

I am working on the segmentation of crown canopy using LiDAR. I want to extract the crowns created after the segmentation as a shapefile. Other documentation and links show that using writeOGR I can ...
Purple_Ad's user avatar
0 votes
0 answers
153 views

lidR: Clipping LAS files with a polygon shapefile using clip_roi

I'm trying to clip a LAScatalog (containing several .las files) with a shapefile (containing multiple polygons). I tried using clip_roi function, however getting an Error: Z only allowed for 3 or ...
TAT's user avatar
  • 1

1
2 3 4 5
7