Skip to content

Instantly share code, notes, and snippets.

@khufkens
Created November 12, 2017 13:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save khufkens/93c0eb19dc9a624ef5f06384f784e968 to your computer and use it in GitHub Desktop.
Median MODIS Land Cover (MCD12Q1) Map
// years to process (from start year t0 to end year t1)
var t0 = "2001";
var t1 = "2014";
var LC = ee.ImageCollection('MCD12Q1')
.select('Land_Cover_Type_1')
.filterDate(t0.concat("-01-01"),t1.concat("-12-31"))
.median();
// Create a geometry representing an export region.
// coordinates in the order xMin, yMin, xMax, yMax.
// add the geodesic FALSE flag to prevent a greater
// circle "rectangle"
var nhemiw = ee.Geometry.Rectangle({coords:[-180, 0, 0, 90],geodesic:false});
var nhemie = ee.Geometry.Rectangle({coords:[0, 0, 180, 90],geodesic:false});
var shemiw = ee.Geometry.Rectangle({coords:[-180, -90, 0, 0],geodesic:false});
var shemie = ee.Geometry.Rectangle({coords:[0, -90, 180, 0],geodesic:false});
// Export the image, specifying scale and region.
// Divide it up into regions (see above) not to choke GEE on export.
// Use smaller areas when needed, in my case I needed global coverage.
Export.image.toDrive({
image: LC,
description: 'MCD12Q1_IGBP_NW',
scale: 500,
maxPixels: 6000000000,
region: nhemiw
});
Export.image.toDrive({
image: LC,
description: 'MCD12Q1_IGBP_NE',
scale: 500,
maxPixels: 6000000000,
region: nhemie
});
Export.image.toDrive({
image: LC,
description: 'MCD12Q1_IGBP_SW',
scale: 500,
maxPixels: 6000000000,
region: shemiw
});
Export.image.toDrive({
image: LC,
description: 'MCD12Q1_IGBP_SE',
scale: 500,
maxPixels: 6000000000,
region: shemie
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment