要获得具有特定区域的las数据集的循环子集,我想使用lidR::clip_circular()。为此,我首先计算我的las数据集的中心点,然后定义我想要使用的半径,以便从我的las数据集的质心中得到一个精确的500米^2的子集。该操作工作正常,不会抛出任何错误,但是结果不正确,请参阅简短代码段末尾的base::print()。
我也尝试使用lidR::clip_roi(),提供一个表示我感兴趣区域的多边形,但是得到了相同的错误结果。现在我不知道该怎么继续下去了。我可以想象,这是关于我正在使用的crs (EPSG:25832),或者因为这个区域是圆形的,而不是矩形的。
las_ctpt <- sf::st_coordinates(sf::st_centroid(sf::st_as_sfc(sf::st_bbox(las_norm, crs = crs_epsg25832), crs = crs_epsg25832), crs = crs_epsg25832))
# get the centroid of the (normalized) las-dataset
buff_radius <- base::sqrt(500/pi)
# calculate the radius to get a circular subset with an area of exactly 500m^2 of the las-dataset
las_subset <- lidR::clip_circle(las = las_norm, radius = buff_radius, xcenter = las_ctpt[, 1], ycenter = las_ctpt[, 2])
# subset the (normalized) las-file
base::print(las_subset)
class : LAS (v1.4 format 6)
memory : 3.7 Mb
extent : 78????.?, 78????.?, 528????, 528???? (xmin, xmax, ymin, ymax)
coord. ref. : ETRS89 / UTM zone 32N
area : 604 m²
points : 38.9 thousand points
density : 64.45 points/m²
density : 47.87 pulses/m²
las_subset_rect <- ((base::sqrt(500/pi))*2)^2
# this should be a rectangular box around the subset I want to have with an area of: (radius*2)^2
base::print(las_subset_rect)
[1] 636.6198
(请注意,由于隐私问题,我已经把我的学习区域的确切位置弄黑了。然而,我使用的是EPSG:25832,这是德国使用的一种度量CRS。
发布于 2022-03-06 11:24:50
我可以用示例数据重现你的问题。
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = lidR::readLAS(LASfile)
las_ctpt <- sf::st_coordinates(sf::st_centroid(sf::st_as_sfc(sf::st_bbox(las))))
buff_radius <- base::sqrt(500/pi)
las_subset <- lidR::clip_circle(las = las, radius = buff_radius, xcenter = las_ctpt[, 1], ycenter = las_ctpt[, 2])
las_subset
#> class : LAS (v1.2 format 1)
#> memory : 51.5 Kb
#> extent : 684867.3, 684892.2, 5017878, 5017903 (xmin, xmax, ymin, ymax)
#> coord. ref. : NAD83 / UTM zone 17N
#> area : 576 m²
#> points : 863 points
#> density : 1.5 points/m²
#> density : 0.96 pulses/m²
然而,这只是一个面积估计不准确的伪像。点云的数学面积为0平方米。所有其他度量都是各种策略的近似。lidR使用2米的分辨率计算占用率网格。这是用户为模仿LAStools而在4.0版中进行的更改。对于不均匀采样的大型数据集,它更准确,但对于小数据集则高估了区域。如果你用凸包计算它( lidR在4.0版本之前所做的),你会得到
sf::st_area(sf::st_convex_hull(las_subset))
#> 484.1633 [m^2]
它更接近预期值
https://stackoverflow.com/questions/71362024
复制相似问题