1

I'm trying to export a raster image from Earth Engine to Google Drive, however it cuts off the top and bottom part of the raster I'd like to have (the portion of the raster marked red in the image).

enter image description here

Here is the code I am using:

//Add MODIS Land Coverage dataset
var dataset = ee.ImageCollection('MODIS/006/MCD12Q1')
  .filterDate('2001-01-01', '2001-12-31');

var LandCover = dataset.select('LC_Prop2');

//Use bands 20, 25, 35 and 36: .eq(36).max(img.eq(35)).max(img.eq(25)).max(img.eq(30))
//Band 36: pure cropland, when cropland is lost, a change to 30/35/25
var LandCoverAgricultureMasked = LandCover.map(function(img) {
                   var mask = img.select(['LC_Prop2']).eq(36).max(img.eq(35)).max(img.eq(25));
                   return img.updateMask(mask)
                        .set('system:time_start', img.get('system:time_start'));
                   });


//Nice colors                  
var LandCoverVis = {
  min: 1.0,
  max: 40.0,
  palette: [
    '05450a', '086a10', '54a708', '78d203', '009900', 'c6b044', 'dcd159',
    'dade48', 'fbff13', 'b6ff05', '27ff87', 'c24f44', 'a5a5a5', 'ff6d4c',
    '69fff8', 'f9ffa4', '1c0dff', '05450a', '086a10', '54a708', '78d203', 
    'dade48', 'fbff13', 'b6ff05', '27ff87', 'c24f44', 'a5a5a5', 'ff6d4c',
    '69fff8', 'f9ffa4', '1c0dff', '05450a', '086a10', '54a708', '78d203',
    'dade48', 'fbff13', 'b6ff05', '27ff87', '27ff87'
  ],
};

//Add fusion table to map
//var thesis_fusion = ee.FeatureCollection('ft:1Mn5wAIvtkzHzUMrG2yQryc9U4qSOa0ycJNEbywj6', 'geometry');
Map.addLayer(roi, {}, "Region of Interest");

//Clip Crop Coverage raster with region of interest (here: Object_ID XX)
var LandCoverAgricultureMaskedMosaic = LandCoverAgricultureMasked.mosaic()
var LandCoverAgricultureMaskedClip = LandCoverAgricultureMaskedMosaic.clip(roi);


Map.addLayer(LandCoverAgricultureMaskedClip, LandCoverVis, 'Agriculture');

//Time series of cropland change over all regions
//print(ui.Chart.image.seriesByRegion(LandCoverAgricultureMasked, thesis_fusion.filter(ee.Filter.eq("system:index", '130')), ee.Reducer.count()));


Export.image.toDrive({
  image: LandCoverAgricultureMaskedClip,
  description: 'Landcover Agriculture in ROI',
  scale: 500
});

Does anyone see the issue?

1

Okay I figured it out, I think the image was too large because I didn't define a region to export, so it cut away a part. I just had to draw a square incorporating my whole region of interest and add it to the export command:

Export.image.toDrive({
  image: LandCoverAgricultureMaskedClip,
  description: 'Landcover Agriculture in ROI',
  scale: 500,
  region: rectangle
});

Then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.