old_spatial_packages function

Older R Spatial Packages

Older R Spatial Packages

lidR 4.0.0 no longer uses the sp and raster packages. New functions are based on sf, terra and stars. However, to maintain backward compatibility the old functions from v<4.0.0 were preserved.

rgdal and rgeos will be retired on Jan 1st 2024. The raster and sp packages are based on rgdal and rgeos. lidR was based on raster and sp because it was created before the sf, terra

and stars packages. This means that sooner or later users and packages that are still based on old R spatial packages will run into trouble. According to Edzer Pebesma, Roger Bivand:

R users who have been around a bit longer, in particular before packages like sf and stars were developed, may be more familiar with older packages like maptools, sp, rgeos, and rgdal. A fair question is whether they should migrate existing code and/or existing R packages depending on these packages. The answer is: yes (see reference).

The following functions are not formally deprecated but users should definitely move their workflow to modern spatial packages. lidR will maintain the old functions as long as it does not generate issues on CRAN. So, it might be until Jan 1st 2024 or later, who knows...

as.spatial(x) ## S3 method for class 'LAS' as.spatial(x) ## S3 method for class 'LAScatalog' as.spatial(x) tree_metrics(las, func = ~list(Z = max(Z)), attribute = "treeID", ...) grid_canopy(las, res, algorithm) grid_density(las, res = 4) grid_terrain( las, res = 1, algorithm, ..., keep_lowest = FALSE, full_raster = FALSE, use_class = c(2L, 9L), Wdegenerated = TRUE, is_concave = FALSE ) grid_metrics( las, func, res = 20, start = c(0, 0), filter = NULL, by_echo = "all" ) find_trees(las, algorithm, uniqueness = "incremental") delineate_crowns( las, type = c("convex", "concave", "bbox"), concavity = 3, length_threshold = 0, func = NULL, attribute = "treeID" )

Arguments

  • x, las: an object of class LAS*
  • func: see template_metrics
  • attribute, type: see crown_metrics
  • ...: ignored
  • res, start: see pixel_metrics
  • algorithm: see rasterize_canopy , rasterize_terrain
  • full_raster, use_class, Wdegenerated, is_concave, keep_lowest: see rasterize_density
  • filter, by_echo: see template_metrics
  • uniqueness: see crown_metrics
  • concavity, length_threshold: see concaveman

References

Edzer Pebesma, Roger Bivand Spatial Data Science with applications in R https://keen-swartz-3146c4.netlify.app/older.html

  • Maintainer: Jean-Romain Roussel
  • License: GPL-3
  • Last published: 2024-07-09