我如何计算三维表面面积(包括地形)的高程栅格地图在R,最好与软件包terra
?类似于GRASS地理信息系统的r.surf.area
模块,或者R sp
包的surfaceArea
函数,但是(如果可能的话)还计算了纬度/经度:
library(terra)
library(sp)
r <- terra::rast(system.file("ex/elev.tif", package="terra"))
terra::expanse(r) # computes 2D surface area, considering the relationship between longlat degrees and meters across the globe
m <- sp::SpatialPixelsDataFrame(points = crds(r), data = data.frame(r))
sp::surfaceArea(m) # computes 3D area, considering the sloping nature of the surface
发布于 2022-04-11 15:29:39
我想你可以用(乘数) 1/cos(slope)
来调整面积。在这种情况下,对于45°的坡度,调整将是sqrt(2)
1/cos(pi/4)
#[1] 1.414214
这样你就能做到
library(terra)
r <- rast(system.file("ex/elev.tif", package="terra"))
area <- cellSize(r)
slope <- terrain(r, "slope", unit="radians")
adjarea <- area / cos(slope)
我看到在草和服务提供商中使用了另一种(也许更好)方法。它们在相邻的细胞中心之间建立三角形,并将这些区域相加。我也可以在地球上实现这一点。
https://stackoverflow.com/questions/71834911
复制