Skip to content

Commit

Permalink
Extent no longer dependent of the subcircle option #518
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Dec 9, 2021
1 parent 4c79f43 commit 8902146
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ New functions are mostly convenient features that simplify some workflow without
15. New functions `header()`, `payload()`, `phb()`, `vlr()`, `evlr()` to get the corresponding data from a `LAS` object.
### Enhancement
1. The bounding box of the CHM not longer depends on the `subcircle` tweak. See [#518](https://github.com/r-lidar/lidR/issues/518).
### Documentation
- Man pages of `classify_*`, `rasterize_*`, `*_metrics`, `segment_*` and `normalize_*` were grouped.
Expand Down
9 changes: 2 additions & 7 deletions R/rasterize_canopy.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ rasterize_canopy.LAS = function(las, res = 1, algorithm = p2r(), ...)
dots <- list(...)
pkg <- if (is.null(dots$pkg)) getOption("lidR.raster.default") else dots$pkg

# Some algorithm have an extra option 'subscircle' that need to buffer the layout
# Must be rewritten because it is a hack !
subcircle <- as.list(environment(algorithm))$subcircle
subcircle <- if (is.null(subcircle)) 0 else subcircle

# Compute the raster that encompass the point cloud
layout <- if (!is_a_number(res)) raster_template(res) else raster_layout(las, res, buffer = subcircle, format = "template")
layout <- if (!is_a_number(res)) raster_template(res) else raster_layout(las, res, format = "template")
layout <- raster_materialize(layout, pkg = "stars")

# Compute the elevation for each cells
Expand All @@ -32,7 +27,7 @@ rasterize_canopy.LAS = function(las, res = 1, algorithm = p2r(), ...)
# Quantize
z <- round(z, 3)

layout <- raster_layout(las, res, buffer = subcircle)
layout <- raster_layout(las, res)
layout <- raster_materialize(layout, pkg = pkg)
layout <- raster_set_values(layout, z)
raster_names(layout) <- "Z"
Expand Down

0 comments on commit 8902146

Please sign in to comment.