0

I want to extract every single MODIS 16 Day NDVI and EVI Data image on a particular area from 2000 to 2016. I was able to filter image collection but I do not know how to export every single image on the collection.

Here is my code:

// Area of interest

var AOI = ee.Geometry.Rectangle([93.8, -8.8, 109.9, 6.84]);

// Go to the center of the map

Map.centerObject(AOI, 4 )

// Find MOD13Q1.005 Vegetation Indices 16 Day Global 250 m

var modis = ee.ImageCollection('MODIS/MOD13Q1')

// Filter the collection

var image = ee.ImageCollection((modis).filterDate(ee.Date('2000-01-01'),ee.Date('2017-12-31')).filterBounds(AOI));

// NDVI dan EVI

var NDVI = image.select(['NDVI']) 
var EVI = image.select(['EVI']) 

//Print the image list on console

print(NDVI)
print(EVI)

//Load it into map

Map.addLayer(NDVI);

I know that my code is too long and not efficient, but it helps me to read and understand it.

Can you help me to write code to export every single NDVI and EVI image on my image collection?

1
  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format.
    – Midavalo
    Commented Dec 15, 2017 at 5:29

2 Answers 2

1

1.change the collection to a list ,and use the for (loop) to export by Export.image

e.g:

    var NDVICollection=ee.ImageCollection('MODIS/MOD13Q1')
                         .filterDate('2000-01-01','2017-12-31')
                         .filterBounds(AOI).select('NDVI'); 

    var list=NDVICollection.toList(length);//the length mean that the volume of collection

    for (var i=0;i<length;i++){
         var image=ee.Image(list.get(i));
         var time=image.get('system:index');
         var name=ee.String(time);

         Export.image.toDrive({ 
             image: image,
             description: name,
             scale: 30,
             maxPixels:1e13
    });
};

it not efficient,but it works.

note:my English is poor ,so i am sorry if i have some expression mistakes.

2
  • Thank you very much for your answer. But this code is too difficult for me as I am still a beginner on this. I will try to make it simpler for me. I was success convert a collection to a list. Now, this is that I want to do next: 1. Extract each image into new variable, e.g. NDVI_img1, NDVI_img2 2. Export images one by one. Can you help me? Commented Dec 16, 2017 at 4:48
  • in order to put my code for you,i write the second comment.you can see it.
    – Mass-Kanf
    Commented Dec 17, 2017 at 10:58
0
    var NDVICollection=ee.ImageCollection('MODIS/MOD13Q1')
                         .filterDate('2000-01-01','2017-12-31')
                         .filterBounds(AOI).select('NDVI'); 

    var list=NDVICollection.toList(10);//depend on your list
    for (var i=1;i<10;i++){
         var image=ee.Image(list.get(i));
         var name=ee.String('NDVI_img')
                    .cat(ee.String(ee.Number(i)))
                    .getInfo();
         print(name)
         Export.image.toDrive({ 
               image: image,
               description:name,
               scale: 250,
               maxPixels:1e13
         });
    }

the result like this: enter image description here

and you can run it into your drive,and download the result: enter image description here

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