【问题标题】:Image stats in Google Earth Engine and rgee package in R?谷歌地球引擎中的图像统计数据和 R 中的 rgee 包?
【发布时间】:2021-04-05 17:52:15
【问题描述】:

我正在尝试计算 Google 地球引擎中图像的县级所有像素的平均值,并且正在使用 R Studio 中的 rgee 包。

我已尝试按照此处的示例进行操作:https://github.com/csaybar/rgee/blob/examples/image/image_stats_by_band.R

代码运行但会在 R 中打印出很长的特征$geometry$coordinates、feature$properties 等,我只想要波段的平均值并希望在后续计算中使用平均值.我想我想要打印的最后一行中的一个值:$features[[1]]$properties$data

#GY16 is an image covering a U.S. state with 1 band and I would like to calculate the mean of that image at the county level. shp1 is the county geometry.  

geometry <- shp1
means <- GY16$reduceRegions(
  collection = geometry,
  reducer = ee$Reducer$mean()$forEachBand(GY16),
  scale=10
)

print(means$getInfo())

感谢任何建议。谢谢!

【问题讨论】:

    标签: r google-earth-engine rgee


    【解决方案1】:

    这个例子是在 rgee 早期版本中制作的,现在你可以使用 ee_extract:

    library(rgee)
    
    # remotes::install_github("r-spatial/rgee") please install rgee v1.0.9
    ee_Initialize()
    
    image <- ee$Image("USDA/NAIP/DOQQ/m_3712213_sw_10_1_20140613")
    geometry <- image$geometry()
    ee_extract(image, geometry, scale = 100, sf = FALSE)
    
    
    

    【讨论】:

    • 我尝试了 ee_extract,但收到以下错误:“值错误 [[3L]](cond):如果您打算通过 getInfo 导出大面积区域,请指定更高的 maxFeatures 值。输入:6101 maxFeatures :“ 有任何想法吗?感谢您对 csaybar 的帮助!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 2019-01-05
    • 1970-01-01
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多