-
-
Notifications
You must be signed in to change notification settings - Fork 139
Open
Labels
BugA bug in the packageA bug in the package
Description
When I specify a SpatRaster template for the res
argument in pixel_metrics
, there is a one-pixel gap between the raster tile outputs. When I specify an integer for res
, there is no gap between the tiles.
This is the underlying function I am using:
vegStructureLAS <- function(las, dtm_res = 1, out_res = 20){
dtm <- rasterize_terrain(las, res = dtm_res, algorithm = knnidw())
nlas <- normalize_height(las, dtm)
nlas_veg <- filter_poi(nlas, Classification == 1L)
heightMetrics <- pixel_metrics(nlas_veg, ~mean(Z), res = out_res)
return(heightMetrics)
}
This code produces a one-pixel gap between the output tiles:
# Create template
rast_template <- rast(
nrows = 3420,
ncols = 3857,
nlyrs = 1,
xmin = 624135,
xmax = 739845,
ymin = 4413555,
ymax = 4516155,
crs = "EPSG:32610"
)
rast_template[] <- NA
# Process LAScatalog
las <- readLAScatalog("./catalog", filter = "-drop_withheld")
opt_output_files(las) <- "{ORIGINALFILENAME}_processed"
opt_chunk_buffer(las) <- 100
new_ctg <- catalog_map(las,
vegStructureLAS,
out_res = rast_template)
This code produces the correct output with no gap between the tiles:
# Process LAScatalog
las <- readLAScatalog("./catalog", filter = "-drop_withheld")
opt_output_files(las) <- "{ORIGINALFILENAME}_processed"
opt_chunk_buffer(las) <- 100
new_ctg <- catalog_map(las,
vegStructureLAS,
out_res = 20)
The tiles used in the example can be found here:
- https://rockyweb.usgs.gov/vdelivery/Datasets/Staged/Elevation/LPC/Projects/CA_SierraNevada_B22/CA_SierraNevada_7_2022/LAZ/USGS_LPC_CA_SierraNevada_B22_10TFK4254.laz
- https://rockyweb.usgs.gov/vdelivery/Datasets/Staged/Elevation/LPC/Projects/CA_SierraNevada_B22/CA_SierraNevada_7_2022/LAZ/USGS_LPC_CA_SierraNevada_B22_10TFK4255.laz
Metadata
Metadata
Assignees
Labels
BugA bug in the packageA bug in the package