【问题标题】:google earth engine javascript error filteringdate谷歌地球引擎javascript错误过滤日期
【发布时间】:2022-01-13 07:10:04
【问题描述】:

您好,我对此一无所知,但我的代码中只有一个错误,我不知道为什么

// Load country features from Large Scale International Boundary (LSIB) dataset.
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
var roi = countries.filter(ee.Filter.eq('country_co', 'CB'));
Map.addLayer(roi,{},'Cambodia')

//Let's centre the map view over our ROI
Map.centerObject(roi, 6);

// Filter the collection for the VV product from the descending track
var collectionVV = ee.ImageCollection('COPERNICUS/S1_GRD')
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
    .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
    .filterBounds(roi)
    .select(['VV'])
    .median();

// Filter the collection for the VH product from the descending track
var collectionVH = ee.ImageCollection('COPERNICUS/S1_GRD')
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
    .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
    .filterBounds(roi)
    .select(['VH'])
    .median();

// Adding the VV layer to the map at a specific date
var image = ee.Image(collectionVV.filterDate('2020-10-14', '2020-10-20').median());
Map.addLayer(image.clip(roi), {min: -25, max: 5}, 'Image_VV');

这是我得到的最后一行:

Line 29: collectionVV.filterDate is not a function

谢谢

【问题讨论】:

    标签: javascript google-earth-engine


    【解决方案1】:

    由于您使用.median() 操作结束了collectionVVcollectionVH 的两个表达式,因此您已经将ImageCollections 减少为一个图像(通过获取该集合的中值)。只需删除 .median() 语句即可修复您的错误。因此:

    // Filter the collection for the VH product from the descending track
    var collectionVH = ee.ImageCollection('COPERNICUS/S1_GRD')
        .filter(ee.Filter.eq('instrumentMode', 'IW'))
        .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
        .filter(ee.Filter.eq('orbitProperties_pass', 'DESCENDING'))
        .filterBounds(roi)
        .select(['VH'])
        //.median();
    
    // Adding the VV layer to the map at a specific date
    var image = ee.Image(collectionVH.filterDate('2020-10-14', '2020-10-20').median());
    Map.addLayer(image.clip(roi), {min: -25, max: 5}, 'Image_VV');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-05
      • 1970-01-01
      • 2019-08-25
      • 1970-01-01
      • 2020-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多