GEE: .get(‘system:time_start‘) is not a function

var sentinel1 = ee.ImageCollection('COPERNICUS/S1_GRD')
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
    .filter(ee.Filter.eq('instrumentMode', 'IW'))
    .filterDate(startDate, endDate)
   .filterBounds(Heze_Villages)
  .map(function(image) {
      var edge = image.lt(-30.0);
      var maskedImage = image.mask()
        .and(edge.not());
      return image.updateMask(maskedImage);
    })
  .filter(ee.Filter.eq('orbitProperties_pass', 'ASCENDING'))
  .map(mask_roi_cm)
  .map(cr).map(nrpb).map(span).map(rvi).map(dpsvi);

筛选出sentinel1影像集合后,获取指定位次(第一幅影像)的影像的信息

var imageCount = sentinel1.size();
print('影像集合中的影像数量:', imageCount);

var s1diaoyong=sentinel1.toList(imageCount).get(0);
//获取日期
var timeLabel = ee.Date(s1diaoyong.get('system:time_start'));
print('System Time Start:', timeLabel);

总是出现错误:error:s1diaoyong.get is not a function

原因:.toList()方法将图像集合转换为列表,但这些图像仍然是服务器端的图像对象,因此我们需要使用服务器端的操作来处理它们。

解决方法:

// 将s1diaoyong转换为服务器端的图像对象
var s1diaoyong_server = ee.Image(s1diaoyong);
print(s1diaoyong,'第一幅影像')
//时间

var date = ee.Date(s1diaoyong_server.get('system:time_start')).format('YYYY-MM-dd');
print('日期 :', date);

输出结果:

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
var s2Sr = ee.ImageCollection('COPERNICUS/S2'); var s2Clouds = ee.ImageCollection('COPERNICUS/S2_CLOUD_PROBABILITY'); var START_DATE = ee.Date('2018-01-01'); var END_DATE = ee.Date('2018-12-31'); var MAX_CLOUD_PROBABILITY = 65; function maskClouds(img) { var clouds = ee.Image(img.get('cloud_mask')).select('probability'); var isNotCloud = clouds.lt(MAX_CLOUD_PROBABILITY); return img.updateMask(isNotCloud); } // The masks for the 10m bands sometimes do not exclude bad data at // scene edges, so we apply masks from the 20m and 60m bands as well. // Example asset that needs this operation: // COPERNICUS/S2_CLOUD_PROBABILITY/20190301T000239_20190301T000238_T55GDP function maskEdges(s2_img) { return s2_img.updateMask( s2_img.select('B8A').mask().updateMask(s2_img.select('B9').mask())); } // Filter input collections by desired data range and region. var criteria = ee.Filter.and( ee.Filter.bounds(table), ee.Filter.date(START_DATE, END_DATE)); s2Sr = s2Sr.filter(criteria).map(maskEdges); s2Clouds = s2Clouds.filter(criteria); // Join S2 SR with cloud probability dataset to add cloud mask. var s2SrWithCloudMask = ee.Join.saveFirst('cloud_mask').apply({ primary: s2Sr, secondary: s2Clouds, condition: ee.Filter.equals({leftField: 'system:index', rightField: 'system:index'}) }); var s2CloudMasked = ee.ImageCollection(s2SrWithCloudMask).map(maskClouds).median(); var rgbVis = {min: 0, max: 3000, bands: ['B4', 'B3', 'B2']}; var rgbVis = {min: 0, max: 3000, bands: ['B4', 'B3', 'B2']}; Map.addLayer( s2CloudMasked, rgbVis, 'S2 SR masked at ' + MAX_CLOUD_PROBABILITY + '%', true);将合成图像的全波段下载
05-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值