1

Why if I applied a code over a MODIS collection and then I download an image, the image is in WGS projection? The code is the next:

// Simple regression of year versus NDVI.

// Define the start date and position to get images covering TDPS,
// Bolivia, from 2000-2010.
var start = '2000-01-01';
var end = '2008-12-31';

var region = table3


// Filter to Collection
// time of year to avoid seasonal affects, and for each image create the bands
// we will regress on:
// 1. A 1, so the resulting array has a column of ones to capture the offset.
// 2. Fractional year past 2000-01-01.
// 3. SAVI.
// 4. Mask Clouds
var col = ee.ImageCollection("MODIS/MOD13Q1")
  .filterDate(start, end)
  .filter(ee.Filter.calendarRange(1,1,'month'))
  .filterBounds(region)
  .map(function(image) {
    var date = ee.Date(image.get('system:time_start'));
    var yearOffset = date.difference(ee.Date(start), 'year');
    var savi = image.expression(
      '(1 + L) * float(nir - red)/ (nir + red + L)',
      {
        'nir': image.select('sur_refl_b02'),
        'red': image.select('sur_refl_b01'),
        'L': 0.5
      });
    return ee.Image(1).addBands(yearOffset).addBands(savi).toDouble();
  });

print(col)
// Convert to an array. Give the axes names for more readable code.
var array = col.toArray();
var imageAxis = 0;
var bandAxis = 1;

// Slice off the year and savi, and solve for the coefficients.
var x = array.arraySlice(bandAxis, 0, 2);
var y = array.arraySlice(bandAxis, 2);
var fit = x.matrixSolve(y).clip(region);

// Get the coefficient for the year, effectively the slope of the long-term
// SAVI trend.
var slope = fit.arrayGet([1, 0]).clip(region);

Map.addLayer(slope);

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: slope,
  description: 'SAVI_slope_jan_MODIS_00_08',
  scale: 250,
  maxPixels: 1e9,
  region: geometry
});

But if I download an image from that collection it is in MODIS SINUSOIDAL. The code is the next:

//Choose country using GEE Feature Collection
var region = table;

var collection = ee.ImageCollection('MODIS/MOD13Q1')
.filterDate('2000-01-01', '2014-12-31')
.filterBounds(region)
.filter(ee.Filter.calendarRange(1,1,'month'));

print(collection)

// Collect data and filter by total dates
var modis_savi = ee.Image('MODIS/MOD13Q1/MOD13Q1_005_2001_01_01');

print(modis_savi)


var savi = modis_savi.expression(
      '(1 + L) * float(nir - red)/ (nir + red + L)',
      {
        'nir': modis_savi.select('sur_refl_b02'),
        'red': modis_savi.select('sur_refl_b01'),
        'L': 0.5
      });



Map.addLayer(savi.clip(region))


// Export the image, specifying scale and region.
Export.image.toDrive({
  image: savi,
  description: 'MODIS_JAN_1_2001',
  scale: 250,
  maxPixels: 1e9,
  region: table
});

Does anyone know why?

  • 1
    Probably because the conversion to/from array caused a reprojection. Why is the exported CRS an issue anyway? If you want to export it in a different projection you could always use the crs parameter to set one. – Kersten Feb 3 '18 at 14:01
  • 1
    Quoting from developers.google.com/earth-engine/exporting If not explicitly specified, the CRS of the output will be taken from the first band of the image to be exported. You may also specify the dimensions, crs and/or crs_transform of the exported image. See the glossary for more information on crs and crs_transform. For example, to get a block of pixels precisely aligned to another data source, specify dimensions, crs and crs_transform. That is for consistency you need to specify the crs parameter, e.g. 'crs':'EPSG:4326' – Dmitri Chubarov Feb 5 '18 at 5:03

Your Answer

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

Browse other questions tagged or ask your own question.