【发布时间】:2019-11-16 18:52:11
【问题描述】:
我有一个从 GEOJson 文件中导入的 FeatureCollection(它是从 shapefile 中提取的)并将其导入以在 Python 中与 Google Earth Engine API 一起使用。
问题是我不知道如何将它与 ImageCollection 的 filterBounds 函数一起使用。我尝试了几种方法,都无法得到想要的结果(主要是错误响应)
我还需要(如果可能的话)找到一种方法来裁剪这些图像,以便结果具有我正在使用的初始形状(在这种情况下是一条河流)
import ee
import json
import geojson
from IPython.display import Image
ee.Initialize()
# GEOJson (extracted from shapefile)
with open("/content/drive/My Drive/.../mascara.json") as json_file:
gjson = geojson.load(json_file)
# FeatureCollection imported from geojson
fc = ee.FeatureCollection(geojson.dumps(gjson))
# Landsat Collection (focus on filterBounds function)
imageCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR').filterBounds(fc).filterDate('2016-12-01','2016-12-31')
# trying to filter image by FeatureCollection (not working at all)
image = ee.Image(imageCollection.sort('CLOUD_COVER').first())
Image(url=image.select(['B5','B4','B3']).getThumbUrl({'min':0,'max':3000}))
我收到了一些错误响应:
EEException: Collection.loadTable: Collection asset '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates":...
我刚开始学习 Google Earth Engine 的 API,但无法获得我需要的过滤图像和河流形状。
【问题讨论】:
-
在 gis stackoverflow 社区发布问题
标签: python google-earth-engine