基于Google Earth Engine批量提取多点位Sentinel-1数据
Google Earth Engine提取多点位Sentinel-1时间序列数据的修正方案
原代码核心问题
- 直接对影像集调用
sampleRegions会丢失每幅影像的时间信息,无法生成可追溯的时间序列数据 - 强制将影像重投影到WGS84属于冗余操作,会增加计算负载且可能引入精度误差
- 未给点位添加唯一标识,导出后无法区分数据对应的具体点位
修正后的代码
// 定义目标点位,添加唯一ID用于区分 var locations = [ {coord: [-120.1331, 39.3272], id: 1}, // 点位1 {coord: [-121.9730, 37.3280], id: 2}, // 点位2 {coord: [-118.4085, 33.9416], id: 3} // 点位3 ]; // 转为带ID的FeatureCollection var locationsFC = ee.FeatureCollection(locations.map(function(item) { return ee.Feature(ee.Geometry.Point(item.coord), {'point_id': item.id}); })); // 地图显示点位 var pointStyle = {color: 'FF0000', fillColor: 'FF0000', pointSize: 8}; Map.addLayer(locationsFC.style(pointStyle), {}, '监测点位'); // 时间范围设置 var startDate = '2023-01-01'; var endDate = '2023-01-20'; // 加载Sentinel-1 GRD数据(仅选VV极化,过滤点位所在影像) var sentinel1 = ee.ImageCollection('COPERNICUS/S1_GRD') .filterBounds(locationsFC) .filterDate(startDate, endDate) .select(['VV']) .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV')) .filter(ee.Filter.eq('instrumentMode', 'IW')); // 限制为IW模式,确保数据分辨率统一 // 定义采样函数:对单幅影像采样,并添加影像日期属性 function sampleSingleImage(image) { var date = image.date().format('YYYY-MM-dd'); return image.sampleRegions({ collection: locationsFC, scale: 10, // Sentinel-1 IW模式VV分辨率为10m tileScale: 16 }).map(function(feature) { return feature.set('image_date', date); }); } // 对所有影像执行采样,合并结果 var sampledData = sentinel1.map(sampleSingleImage).flatten(); // 导出CSV到Google Drive Export.table.toDrive({ collection: sampledData, description: 'sentinel1_vv_time_series', fileFormat: 'CSV', selectors: ['point_id', 'image_date', 'VV'] // 指定导出字段,避免冗余属性 });
关键修正说明
- 点位添加ID:通过给每个点位设置
point_id属性,导出后能明确区分每个数据对应的监测点 - 保留时间信息:遍历影像集合时,为每个采样结果添加
image_date字段,记录影像拍摄日期,形成完整时间序列 - 取消冗余重投影:直接使用影像原生投影采样,指定10m分辨率即可保证采样精度
- 过滤影像条件:新增
instrumentMode和transmitterReceiverPolarisation过滤,确保只获取IW模式的VV极化数据,避免无关影像干扰
内容的提问来源于stack exchange,提问作者srinivas
相关产品推荐
相关产品推荐

