1

I have created image collection in GEE of LANDSAT 7 NDVI (LANDSAT/LE07/C01/T1_8DAY_NDVI). I chose date range and I know I have 71 images in the image collection.

Is there any way to clip all the image collection according to a shapefille I have and see them as layers? Should I build function that calls every image and visualize it?

I used filterBound and the code run but when I try to visualize even just one image it doesn't really filter it according to the shape. My end goal is to download all the NDVI images I have for that period clipped according to the shapefille

0

to clip your collection you can do something like that

var clippedCol=col.map(function(im){ 
   return im.clip(myGeometry);
});

but if it's to export all the images you can simply try something like that:

Export.image.toDrive({image:col.toBands(),
                  region:myGeometry,
                  scale:30});

Where you specify your geometry for the clip, and use toBands() to convert the stack of images as a single image with lot of bands.

0

For clarification, filterBounds does not clip images, it only removes all images not intersect with the bound. If you want to clip every image in your collection, just use map and clip function as suggested in the first snippet of code suggested by Mathieu Gravey.

For exporting all NDVI images (there should be 71 of them, I guess), Mathieu Gravey's answer provides one good approach, but you may need to convert each band to a single image after exporting. There're two other approaches to export those NDVI images:

  • If you don't mind clicking 71x2 = 142 times, you may use col.map(function(img) { Export.image.toDrive({image: img, scale: 30, region: yourShapefile}) }) to export each NDVI image.
  • Use Earth Engine Python API instead of JavaScript API. This will export every image without asking a single click.

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.