Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using grid_metrics with a raster instead of a resolution preserves the old values #318

Closed
Jean-Romain opened this issue Jan 29, 2020 · 0 comments
Assignees
Labels
Bug A bug in the package

Comments

@Jean-Romain
Copy link
Collaborator

When using a RasterLayer as layout in grid_metrics() the values of the reference are preserved:

library(lidR)
#> Le chargement a nécessité le package : raster
#> Le chargement a nécessité le package : sp

LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
ldr = readLAS(LASfile)
ldr10 = lasfilter(ldr, abs(ScanAngleRank) <= 5)

# Expected behavior
ref = lidR:::rOverlay(ldr, 10)
plot(grid_metrics(ldr10, mean(Z), ref))

# Invalid behavior
ref[] <- 1
plot(grid_metrics(ldr10, mean(Z), ref))

Created on 2020-01-29 by the reprex package (v0.3.0)

@Jean-Romain Jean-Romain self-assigned this Jan 29, 2020
@Jean-Romain Jean-Romain added the Bug A bug in the package label Jan 29, 2020
@Jean-Romain Jean-Romain changed the title Using grid_metrics with a raster instead of a resolution preserve the old values Using grid_metrics with a raster instead of a resolution preserves the old values Jan 29, 2020
Jean-Romain added a commit that referenced this issue Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the package
Projects
None yet
Development

No branches or pull requests

1 participant