在googleearth引擎中使用python查询大型FeatureCollection

2024-09-30 04:29:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试从here下载的进程坦桑尼亚形状文件。在

    # im -> {Image} ee.Image({...})
    # self.geom_coll -> {FeatureCollection} ee.FeatureCollection({...}). containing 
    # 3000 features.
    # spacereducer() -> ee.Reducer.mean
    # self.scale -> 10 #Changing this value to small number gives error

    feats = im.reduceRegions(self.geom_coll, spacereducer(), self.scale)
    flist = getInfo_werrorcontrol(feats,
                          self.errorcheck)['features']

一。在

^{pr2}$

self.scale更改为10会对行引发以下错误:

featureCollection.getInfo()

ee.ee_exception.EEException: Server returned HTTP code: 413

self.scale更改为1000会引发此错误:

ee.ee_exception.EEException: Computation timed out

处理较大区域的形状文件的正确方法是什么?在


Tags: 文件imageself错误eefeaturecollectionfeatures形状
1条回答
网友
1楼 · 发布于 2024-09-30 04:29:40

注意,对地球引擎API的请求是already wrapped with exponential backoff。所以你的代码对解决问题没有多大作用。这些错误是如何从您发布的代码中产生的并不明显,但无论哪种情况,答案可能都是相同的:导出结果。示例:

import ee
ee.Initialize()
image = ee.Image('srtm90_v4')
geometry = ee.Geometry.Polygon([[[-113.64, 39.97], [-113.64, 38.13],[-109.42, 38.13],[-109.42, 39.97]]], None, False)
dict = image.reduceRegion(reducer=ee.Reducer.mean(), geometry=geometry, scale=1000)
featureCollection = ee.FeatureCollection([ee.Feature(None, dict)])
task = ee.batch.Export.table.toDrive(collection=featureCollection, description='foo', fileNamePrefix='foo', fileFormat='CSV')
task.start()
print task.status()

导出的输出将具体化到您的Google驱动器文件夹中。要了解更多有关缩放的信息,请参见this doc。在

相关问题 更多 >

    热门问题