'Exporting a Clipped Image from MODIS Data collection in Google Earth Engine
I need to download vegetative cover fraction of Alaska region. I have clipped the file in google earth engine. However, when I tried to download the file to my drive. Along with the alaska region, a very wide horizontal portion (with out any world regions) is getting downloaded. Is there anyway, I can download only the Alaska region, instead of wider region.
Following is the code I have tried.
// Load MODIS 44B raw imagery and filter it to 2019 to 2020 year.
var collection = ee.ImageCollection("MODIS/006/MOD44B")
.filterDate('2019-01-01', '2019-12-30').first().select(['Percent_Tree_Cover','Percent_NonTree_Vegetation']);
// print(collection);
// Reduce the collection by taking the median.
// var median = collection.median();
// Load a table of state boundaries and filter.
var fc = ee.FeatureCollection('TIGER/2016/States')
.filter(ee.Filter.or(
ee.Filter.eq('NAME', 'Alaska')));
// Clip to the output image to the Nevada and Arizona state boundaries.
var clipped = collection.clipToCollection(fc);
print(clipped);
// Display the result.
// Map.setCenter(-110, 40, 5);
// var visParams = {bands: ['B3', 'B2', 'B1'], gain: [1.4, 1.4, 1.1]};
// Map.addLayer(clipped, visParams, 'clipped composite');
// print(visualization);
// var outdata = clipped.select(['Percent_Tree_Cover','Percent_NonTree_Vegetation']).bandNames();
// print(outdata);
// var vegetation = outdata.select('Percent_Tree_Cover').add(outdata.select('Percent_NonTree_Vegetation'))
// var visualization = {
// bands: ['Percent_Tree_Cover'],
// min: 0.0,
// max: 100.0,
// palette: ['bbe029', '0a9501', '074b03']
// };
// Map.centerObject(collection);
// Map.addLayer(clipped, visualization, 'Percent_NonTree_Vegetation');
Export.image.toDrive({
image: clipped,
description: 'out4',
scale : 2500,
region: fc
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
