首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rgee中的桶是什么?

rgee中的桶是什么?
EN

Stack Overflow用户
提问于 2020-12-23 06:10:47
回答 1查看 86关注 0票数 0

我正在尝试上传一些大的几何图形到谷歌地球引擎。

以下是?sf_as_ee描述中给出的示例代码:

代码语言:javascript
复制
# # 3. Upload large geometries to EE asset
# ee_Initialize(gcs = TRUE)
# assetId <- sprintf("%s/%s", ee_get_assethome(), 'toy_poly_gcs')
#  eex <- sf_as_ee(
#  x = toy_poly,
#  overwrite = TRUE,
#  assetId = assetId,
#  bucket = 'rgee_dev',
#  monitoring = FALSE,
#  via = 'gcs_to_asset'
#  )

我只需要知道如何设置bucket

发自描述:

存储桶字符。要保存中间文件的存储桶(GCS)名称(如果未将via定义为“gcs_to_asset”,则忽略此项)。

我认为它是用于保存中间文件的本地空间,但我无法让它与我通常用于临时文件的文件夹(bucket = 'tempfiles')一起使用。

它在我的工作目录中,但是抛出了这个错误:

代码语言:javascript
复制
Error in value[[3L]](cond) : The data bucket was not found.

供参考的文件结构:(在MacOS上)

-R项目(工作目录)

--脚本

-脚本

--临时文件

我也试着将其设置为google驱动器文件夹名称,以为它可能会要求这样做,但也不起作用。任何帮助都将不胜感激!

谢谢!

EN

回答 1

Stack Overflow用户

发布于 2020-12-23 23:20:41

sf_as_ee(...,via = "gcs_to_asset")是一个两步函数。首先,将几何图形上传到Google Cloud Storage ( GCS ),然后使用manifests upload从GCS迁移到Earth Engine。

要使用sf_as_ee(...,via =“gcs_to_asset”),必须使用保存一个具有读/写service account key资源权限的文件。不能通过 Drive上传文件。

代码语言:javascript
复制
library(rgee)
library(googleCloudStorageR)
ee_Initialize("csaybar", gcs = TRUE)
#> ── rgee 1.0.7 ─────────────────────────────────────── earthengine-api 0.1.245 ── 
#>  ✓ email: csaybar 
#>  ✓ GCS credentials: NOT FOUND
#>  ✓ Initializing Google Earth Engine:  DONE!
#>  ✓ Earth Engine user: users/csaybar 
#> ────────────────────────────────────────────────────────────────────────────────
#> Unable to find a service account key (SAK) file in: /home/csaybar/.config/earthengine//csaybar
#> Please, download and save the key manually on the path mentioned
#> before. A compressible tutorial to obtain their SAK file is available in:
#> > https://github.com/r-spatial/rgee/tree/help/gcs
#> > https://cloud.google.com/iam/docs/creating-managing-service-account-keys
#> > https://console.cloud.google.com/apis/credentials/serviceaccountkey
#> Until you do not save a SKA file, the following functions will not work:
#> - rgee::ee_gcs_to_local()
#> - ee_as_raster(..., via = "gcs")
#> - ee_as_stars(..., via = "gcs")
#> - ee_as_sf(..., via = "gcs")
#> - sf_as_ee(..., via = "gcs_to_asset")
#> - gcs_to_ee_image
#> - raster_as_ee
#> - local_to_gcs
#> - stars_as_ee

guide说明了如何生成SAK,然后,您需要将其保存到:

代码语言:javascript
复制
rgee::ee_get_earthengine_path()
#> [1] "/home/csaybar/.config/earthengine//csaybar/"

出现此特定错误(Error in value[[3L]](cond): The data bucket was not found.)是因为googleCloudStorageR无法识别您的SAK (因此无法识别您的GCS存储桶名称)。

代码语言:javascript
复制
library(googleCloudStorageR)
gcs_get_bucket('rgee_dev') # I have privileges to modify the bucket (rgee will work!)
#> ==Google Cloud Storage Bucket==
#> Bucket:          rgee_dev 
#> Project Number:  XXXXXXXXXXXXXX 
#> Location:        US 
#> Class:           STANDARD 
#> Created:         2020-02-08 01:00:23 
#> Updated:         2020-12-10 15:00:47 
#> Meta-generation: 8 
#> eTag:            XXX

gcs_get_bucket('tempfiles') # I do not have privileges privileges to modify the bucket (rgee will not work!)
#> ℹ 2020-12-23 16:16:22 > Request Status Code:  403
#> Error: API returned: gcs-auth-file@rgee-267600.iam.gserviceaccount.com does not
#> have storage.buckets.get access to the Google Cloud Storage bucket.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65416454

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档