I'm having difficulty with the method to obtain the percentage of points classified as ground using grid_metrics(). I would like to implement pground (one metric) like stdmetrics (a set of metrics), but can't see how.

Does it have to be set up in a custom function instead?

The reference I'm using:


1 Answer 1


It is not clear what your problem is. If the following does not anwser your question please edit your question to clarify.

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile)
pground <- grid_metrics(las, ~sum(Classification == LASGROUND)/.N*100, 10)
plot(pground, col = gray.colors(50))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.