【发布时间】:2021-05-01 09:15:45
【问题描述】:
我正在尝试研究如何在 Google 地球引擎中沿样带提取数据 - 最好是在定义的时间间隔内。在Jupyter notebook 中使用Python API 我已经映射了一些数据,缓冲了一个点(以定义感兴趣的区域),并映射了一个样带。我不知道我是否应该使用 ee 方法来提取沿lineString 约束的数据(我认为这不是一个形状?),或者我是否朝着错误的方向前进并且应该导出缓冲区域作为 GeoTIFF 来处理QGIS/ArcGIS 中的样带。
import ee
ee.Initialize()
def maskS2clouds(image):
qa = image.select('QA60')
# Bits 10 and 11 are clouds and cirrus, respectively.
cloudBitMask = 1 << 10
cirrusBitMask = 1 << 11
# Both flags should be set to zero, indicating clear conditions.
mask = qa.bitwiseAnd(cloudBitMask).eq(0) \
.And(qa.bitwiseAnd(cirrusBitMask).eq(0))
return image.updateMask(mask).divide(10000)
centre = ee.Geometry.Point(-115.435272, 35.584001,)
centreBuffer = centre.buffer(5000)
dataset = ee.ImageCollection('COPERNICUS/S2_SR') \
.filterDate('2020-07-01', '2020-07-31') \
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE',20)) \
.map(maskS2clouds)
visualization = {
'min': 0.0,
'max': 0.3,
'bands': ['B4', 'B3', 'B2'], # Red, Green, BLue. 10m resolution.
}
Map.setCenter(-115.435272, 35.584001, 12)
# Map = geemap.Map(center=[35.584001, -115.435272], zoom=14)
Map.addLayer(dataset.mean(), visualization, 'RGB')
Map.addLayer(centre,
{'color': 'black'},
'Geometry [black]: point');
Map.addLayer(centreBuffer,
{'color': 'red'},
'Result [red]: point.buffer')
transect = ee.Geometry.LineString([[-115.4, 35.584001], [-115.45, 35.584001]]);
Map.addLayer(transect, {'color': 'Green'}, 'transect');
Map
【问题讨论】:
标签: python gis google-earth-engine