计算 SpatialPoints 对象 r 的面积

Calculate area of SpatialPoints object r

我在计算 SpatialPoints 对象跨越的区域时遇到问题。我需要以 m^2 为单位的面积。我的对象的代码如下。我似乎无法在网上找到答案。任何帮助将不胜感激,提前致谢!

new("SpatialPoints", coords = structure(c(365901.718425453, 365840.735248348, 
365658.787059115, 365358.861441992, 364945.883167318, 364426.633326947, 
363809.637988903, 363105.028199579, 362324.373632234, 361480.492613283, 
360587.241645727, 359659.287885757, 358711.868308457, 357760.539517095, 
356820.922304122, 355908.4451582, 355038.090928836, 354224.150808417, 
353479.989671215, 352817.82662253, 352248.534361316, 351781.460650762, 
351424.274828283, 351182.841875208, 351061.126113954, 351061.126113954, 
351182.841875208, 351424.274828283, 351781.460650762, 352248.534361316, 
352817.82662253, 353479.989671215, 354224.150808417, 355038.090928836, 
355908.4451582, 356820.922304122, 357760.539517094, 358711.868308457, 
359659.287885757, 360587.241645727, 361480.492613283, 362324.373632234, 
363105.028199579, 363809.637988903, 364426.633326947, 364945.883167318, 
365358.861441992, 365658.787059115, 365840.735248348, 365901.718425453, 
365901.718425453, 471406.967507941, 470123.485439601, 468861.07811134, 
467640.474216585, 466481.716037545, 465403.830351483, 464424.516011563, 
463559.853332175, 462824.040050607, 462229.1582006, 461784.975725686, 
461498.786089822, 461375.288518918, 461416.510839672, 461621.776182718, 
461987.714096798, 462508.31589148, 463175.033299687, 463976.91884001, 
464900.805574046, 465931.523307164, 467052.147682681, 468244.278079334, 
469488.339748967, 470763.90523336, 472050.029782522, 473325.595266915, 
474569.656936548, 475761.787333201, 476882.411708718, 477913.129441836, 
478837.016175871, 479638.901716194, 480305.619124402, 480826.220919084, 
481192.158833164, 481397.42417621, 481438.646496964, 481315.14892606, 
481028.959290196, 480584.776815282, 479989.894965275, 479254.081683707, 
478389.419004318, 477410.104664399, 476332.218978337, 475173.460799296, 
473952.856904542, 472690.449576281, 471406.967507941, 471406.967507941
), .Dim = c(51L, 2L), .Dimnames = list(NULL, c("X_rotated", "Y_rotated"
))), bbox = structure(c(351061.126113954, 461375.288518918, 365901.718425453, 
481438.646496964), .Dim = c(2L, 2L), .Dimnames = list(c("X_rotated", 
"Y_rotated"), c("min", "max"))), proj4string = new("CRS", projargs = "+proj=sterea +lat_0=52.1561605555556 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs"))

您可以使用 sf 包来完成所需的输出。首先,您需要将点数据转换为 sf,然后计算其边界框并从该框创建一个多边形。最后,你只需要用st_area.

计算它的面积
library(sf)

# First convert to sf
st_as_sf(df) |>
  # Get bounding box of points
  st_bbox(df) |>
  # Create bbox polygon from bbox
  st_as_sfc() |>
  # Calculate area
  st_area()

# 297752116 [m^2]