You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GEE导出MODIS NDVI时间序列报错:无法转换几何至指定投影

解决GEE中MODIS NDVI时间序列导出的投影转换错误

错误原因分析

你遇到的Image.reduceRegion: Unable to transform geometry into requested projection错误,核心原因是混淆了两个完全不同的scale参数:

  • 你定义的scale = 0.0001是MODIS NDVI的数值缩放因子(用于将原始整数DN值转换为[-1,1]的实际NDVI值)
  • 但在reduceRegion中,scale参数要求的是空间分辨率(单位:米),MOD13Q1的空间分辨率是250米,填0.0001会导致GEE尝试以极小的分辨率转换投影,直接触发错误。

此外,手动将点转换为影像投影的操作是多余的,反而可能引发投影不兼容问题——MODIS采用的正弦曲线投影(Sinusoidal)对部分区域的转换存在限制,直接使用WGS84坐标的点即可,GEE会自动处理投影适配。

修正后的代码

////////// Input

// Specify dataset
var dataset = 'MODIS/061/MOD13Q1';

// Specify variable name
var variable = 'NDVI';

// 区分:数值缩放因子 vs 空间分辨率
var ndviScaleFactor = 0.0001; // MODIS NDVI的数值缩放因子
var spatialScale = 250; // MOD13Q1的空间分辨率(米)

// Specify the date range of interest
var startDate = '2010-01-01';
var endDate = '2022-12-31';

// Specify a list of sites with names and coordinates
var sites = [
  {'name': 'AAC001', 'lat': 59.664, 'lon': 10.762},
  {'name': 'WUC002', 'lat': 50.505, 'lon': 6.331}
];

////////// Processing

// Load the image collection
var collection = ee.ImageCollection(dataset)
                 .filterDate(startDate, endDate)
                 .select(variable);

// Loop over the sites and export the time series as a CSV file for each site
sites.forEach(function(site) {
  
  // 直接使用WGS84坐标创建点,无需手动转换投影
  var point = ee.Geometry.Point(site.lon, site.lat);

  // Filter the image collection based on the point geometry
  var collectionPoint = collection.filterBounds(point);

  // Get the value for point for each image in the collection
  var timeseries = collectionPoint.map(function(image) {
    var mean = image.reduceRegion({
      reducer: ee.Reducer.mean(),
      geometry: point,
      scale: spatialScale, // 使用正确的空间分辨率
      maxPixels: 1e9,
    });
    // 应用数值缩放因子,转换为实际NDVI值
    var ndviValue = ee.Number(mean.get(variable)).multiply(ndviScaleFactor);
    return image.set({
      'site': site.name,
      'NDVI': ndviValue,
      'date': image.date().format('YYYY-MM-dd') // 新增日期字段,便于后续分析
    });
  });

  // Export the time series as a CSV file
  Export.table.toDrive({
    collection: timeseries,
    description: dataset.replace(/\//g, '_') + '_' + variable + '_' + site.name,
    fileFormat: 'CSV',
    selectors: ['site', 'date', 'NDVI'] // 指定导出字段,避免冗余
  });
});

关键修改说明

  1. 参数拆分:将原有的scale拆分为ndviScaleFactor(数值转换用)和spatialScale(空间分辨率用),避免参数混淆
  2. 移除手动投影转换:直接使用WGS84坐标创建点,让GEE自动处理投影适配
  3. 正确应用数值缩放:在获取均值后,通过multiply(ndviScaleFactor)将原始DN值转换为实际NDVI值
  4. 优化导出字段:新增site和date字段,指定导出选择器,让CSV结果更易读

内容的提问来源于stack exchange,提问作者Toni S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 10:12:16