0

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?

  • what have you tried? can you provide a code? (the one that did not work as expected) – Rodrigo E. Principe Sep 15 at 9:58
  • This Q&A might be helpful - it is a very similar task to yours: gis.stackexchange.com/q/343696/68792 – Justin Braaten Sep 15 at 17:35
  • @RodrigoE.Principe Yes, I have updated the question with scripts I tried. Thank you – niranjan ravi Sep 17 at 5:49
  • @JustinBraaten Thank you, I did see the post and tried to replicate it. My goal is just the extraction of one particular column - LST_Day_1km and not sure if I have to calculate any mean value of pixels for this approach. – niranjan ravi Sep 17 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.