TransWikia.com

Looping FeatureCollection and ImageCollection in Google Earth Engine editor

Geographic Information Systems Asked by niranjan ravi on April 13, 2021

I have an image collection and feature collection. In my image collection, I have filtered the dates and a specific band by this:
”’

var imagecollectionL8 = ee.ImageCollection("MODIS/006/MOD11A1").
                        filterDate('2020-02-01', '2020-06-30').
                        select(['LST_Day_1km']);    //About 150 Images
'''

My featureCollection contains list of counties in United States:

var counitesList= ee.FeatureCollection("TIGER/2018/Counties");

I wanted to loop my imageCollection through this featureCollection and extract "LST_Day_1km" for each county on all my filtered dates and export it to a drive as CSV. I followed scripts in Google editor API but unable to find the correct method(tried clipping, reduceRegions).

I added this function at the end of the code

Export.table.toDrive({
  collection: finalCollection,
  description: 'l8_finalCollection',
  folder: 'finalCollection_test',
  fileFormat: 'CSV'});

Still dint work.

Another approach which I tried is, separating the firs Image in my image collection and passing it through the below code;

var Features = firstImage.reduceRegions   //Just FirstImage
  ({
  collection: counties,
  reducer: ee.Reducer.mean(),
  scale: 30,
  });
  
  Export.table.toDrive
  ({
   collection: Features,
   description : "vectorsToDriveExample",
  fileFormat: "CSV"
  })

I got the LST_Day_1km and is it the right approach to do it? Or any other better ways?

I want to iterate through my image collection rather than reducing it to a single image. How can I do this with Python API or JavaScript inputs?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP