Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Oct 24, 2024
1 parent c718b5e commit d7f83b9
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 80 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export(header)
export(height.colors)
export(height_above_ground)
export(hexagon_metrics)
export(hexbin_metrics)
export(highest)
export(homogenize)
export(index)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ v4.2.0 brings new tools for terrestrial data (TLS, MLS):
- New: Introduced the function `knn_distance()` to measure the average distance between a point and its neighborhood.
- New: Added a C++ spatial indexing class `SparsePartition3D` for TLS data, optimized for memory usage.
- New: Introduced the functions `readALS()` and `readTLS()`, which replace the overly complex and rarely used `readALSLAS()`, `readTLSLAS()`, `readUAVLAS()`, and related functions.
- New: `readLAS()` automatically detects if the point cloud is TLS or ALS. `readALS()` and `readTLS()` should be preferred in order to avoid false positive. The print function was updated to display what lidar type is registered.
- New: Added the functions `readALScatalog()` and `readTLScatalog()` to replace the complex and less-used `readALSLAScatalog()`, `readTLSLAScatalog()`, `readUAVLAScatalog()`, and related functions.
- New: Added the function `fit_circle()` using a RANSAC-based approach.
- New: Added the function `height_above_ground()`
Expand Down
2 changes: 1 addition & 1 deletion R/connected_components.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @export
connected_components = function(las, res, min_pts, name = "clusterID")
{
.N <- N <- cluster <- gpstime <- NULL
.N <- N <- clusterID <- gpstime <- NULL

u = C_connected_component(las, res)
las = add_lasattribute(las, u, name, "connected component ID")
Expand Down
36 changes: 7 additions & 29 deletions R/deprecated.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
#' Deprecated functions in lidR
#'
#' These functions are provided for compatibility with older versions of lidR but are deprecated. They
#' will progressively print a message, throw a warning and eventually be removed. The links below point
#' to the documentation of the new names. In version 4 they now throw an error. In version 4.1 they
#' ill be removed definitively.\cr\cr
#' \link[=add_attribute]{lasadd} \link[=las_check]{lascheck} \link[=clip]{lasclip}
#' \link[=segment_shapes]{lasdetectshape} \link[=filter_poi]{lasfilter}
#' \link[=filter_surfacepoints]{lasfiltersurfacepoints} \link[=retrieve_flightlines]{lasflightline}
#' \link[=classify_ground]{lasground} \link[=merge_spatial]{lasmergespatial}
#' \link[=normalize_height]{lasnormalize} \link[=retrieve_pulses]{laspulse}
#' \link[=normalize_intensity]{lasrangecorrection} \link[=retrieve_flightlines]{lasflightline}
#' \link[=las_reoffset]{lasreoffset} \link[=las_rescale]{lasrescale}
#' \link[=retrieve_scanlines]{lasscanlines} \link[=smooth_height]{lassmooth}
#' \link[=segment_snags]{lassnags}
#' \link[=segment_trees]{lastrees} \link[=voxelize_points]{lasvoxelize}
#' \link[=track_sensor]{sensor_tracking} \link[=locate_trees]{tree_detection}
#' \link[=crown_metrics]{tree_hull}
#' These functions are provided for compatibility with older versions of lidR but are deprecated.
#'
#' @param las,res See the new functions that replace the old ones
#' @param files,select,sort See the new functions that replace the old ones
#' @param files,select,filter,sort See the new functions that replace the old ones
#'
#' @rdname deprecated
#' @name deprecated
Expand All @@ -42,31 +27,24 @@ readTLSLAS = readTLS
readUAVLAS = readTLS

#' @export
#' @rdname readLAS
#' @rdname deprecated
readDAPLAS = readTLS

#' @export
#' @rdname readLAScatalog
#' @rdname deprecated
readALSLAScatalog = readALScatalog

#' @export
#' @rdname readLAScatalog
#' @rdname deprecated
readTLSLAScatalog = readTLScatalog

#' @export
#' @rdname readLAScatalog
#' @rdname deprecated
readUAVLAScatalog = readTLScatalog

#' @export
#' @rdname readLAScatalog
readDAPLAScatalog = readTLScatalog

#' @export
#' @rdname deprecated
hexbin_metrics = function(...)
{
.lidr3depreciation("hexagon_metrics")
}
readDAPLAScatalog = readTLScatalog

#' @export
#' @rdname deprecated
Expand Down
2 changes: 1 addition & 1 deletion R/io_readLAS.R
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,5 @@ streamLAS.character = function(x, ofile, select = "*", filter = "", filter_wkt =
}
}

return(LAS(data, header, check = TRUE, index = LIDRDEFAULTINDEX, no_attr_name_check = TRUE))
return(LAS(data, header, check = TRUE, index = NULL, no_attr_name_check = TRUE))
}
17 changes: 16 additions & 1 deletion R/methods-LAS.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,22 @@ LAS <- function(data, header = list(), crs = sf::NA_crs_, check = TRUE, index =
crs <- st_crs(header)

if (is.null(index))
index <- LIDRDEFAULTINDEX
{
xrange = header[["Max X"]] - header[["Min X"]]
yrange = header[["Max Y"]] - header[["Min Y"]]
zrange = header[["Max Z"]] - header[["Min Z"]]
area = xrange*yrange
n = nrow(data)
density = n/area
zratio = min(zrange/xrange, zrange/yrange)

if (zratio < 10/100)
index <- LIDRALSINDEX
else if ((zratio > 10/100 & density > 100) || density > 1000)
index <- LIDRTLSINDEX
else
index <- LIDRALSINDEX
}

index$xprt <- NULL

Expand Down
4 changes: 2 additions & 2 deletions R/normalize.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#' \item{normalize_intensity}{Normalize intensity values using multiple methods. The attribute 'Intensity'
#' records the normalized intensity. An extra attribute named 'RawIntensity' records the original
#' intensities.}
#' \item{height_above_ground} instead of normalizing the point cloud, records the height above ground (HAG)
#' in a new attribute named 'hag'
#' \item{height_above_ground}{instead of normalizing the point cloud, records the height above ground (HAG)
#' in a new attribute named 'hag'}
#' }
#'
#' @section Non-supported LAScatalog options:
Expand Down
6 changes: 6 additions & 0 deletions R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ setMethod("show", "LAS", function(object)
format <- phb[["Point Data Format ID"]]
units <- st_crs(object)$units
units <- if (is.null(units) || is.na(units)) "units" else units
type <- sensor(las)
if (type == TLSLAS) type = "Terrestrial"
else if (type == ALSLAS) type = "Airborne"
else if (type == UKNLAS) type = "Unknown"
else type = "Unknown"

areaprefix <- ""
pointprefix <- ""
Expand Down Expand Up @@ -186,6 +191,7 @@ setMethod("show", "LAS", function(object)
cat("coord. ref. :", st_crs(object)$Name, "\n")
cat("area : ", area.h, " ", areaprefix, units, "\u00B2\n", sep = "")
cat("points : ", npoints.h, " ", pointprefix, " points\n", sep = "")
cat("type : ", type, "\n", sep = "")
cat("density : ", round(dpts, 2), " points/", units, "\u00B2\n", sep = "")
if (dpulse > 0)
cat("density : ", round(dpulse, 2), " pulses/", units, "\u00B2\n", sep = "")
Expand Down
13 changes: 7 additions & 6 deletions R/utils_spatial_index.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
LIDRSPATIALINDEXES <- c("auto", "gridpartition", "voxelpartition", "quadtree", "octree")
LIDRAUTOINDEX <- 0L
LIDRGRIDPARTITION <- 1L
LIDRVOXELPARTITION <- 2L
LIDRQUADTREE <- 3L
LIDROCTREE <- 4L
LIDRSPATIALINDEXES <- c("auto", "gridpartition", "voxelpartition", "quadtree", "octree", "sparcepartition")
LIDRAUTOINDEX <- 0L
LIDRGRIDPARTITION <- 1L
LIDRVOXELPARTITION <- 2L
LIDRQUADTREE <- 3L
LIDROCTREE <- 4L
LIDRSPARSEPARTITION <- 5L

LIDRAQUISITIONDEVICES <- c("unknown", "als", "tls", "uav", "dap", "multispectral")
UKNLAS <- 0L
Expand Down
35 changes: 16 additions & 19 deletions man/deprecated.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/normalize.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot_3d.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions man/readLAS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions man/readLAScatalog.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7f83b9

Please sign in to comment.