I have a feature collection consisting of three individual features, each of which represents an AOI in an area. Now I want to get each feature separately to load the appropriate Sentinel2 data for it. First of all I load the FIRMS (MODIS) Data and convert day to date. Then I clip the mosaic to my AOI. This is my code:

  var FIRMS_filtered = ee.ImageCollection('FIRMS')
 .filterDate('2018-01-01', '2018-12-31')
 .map(function(image) {
 var date = ee.Date(image.get('system:time_start')).format("YYYY-DDD");
 date = ee.Date(date);
 return image.set('date', date);
.map(function(image) {
var ID = ee.String(image.get('system:index'));
 return image.set('ID', ID);
.map(function(image) {
 var date = ee.Date(image.get('system:time_start'));
 return image.set('date_time', date);

Then I create a Vector from the result and a Buffer.

  //Creation AOI mask for vectorization
  var T21 = FIRMS_filtered.mosaic().clip(AOI).select('T21');
  var zones = T21.gt(0);
  zones = zones.updateMask(zones.neq(0));

  //Creation of vector
  var vectors = zones.addBands(T21).reduceToVectors({
  geometry: AOI,
  crs: T21.projection(),
  scale: 500,
  geometryType: 'polygon',
 eightConnected: false,
 labelProperty: 'zone',
 reducer: ee.Reducer.mean()});

//Function for creating buffer
var buffer = function(feature) {
return feature.buffer(2000);};
//Creation buffer
var bounds_AOI = vectors.map(buffer);

The result is a Feature Collection with 3 Features. Now I want to get each of this Features single. How can I do this?

Here is the code



Not the best answer, and would only work with your code. This solution is not at all portable.

You can add this to your code at the bottom.

var bounds_AOI_West = bounds_AOI.filterMetadata("system:index","equals","+5270+8474").first()

var bounds_AOI_Center = bounds_AOI.filterMetadata("system:index","equals","+5308+8474").first()

var bounds_AOI_East = bounds_AOI.filterMetadata("system:index","equals","+5344+8474").first()

Now you have each of the features in their own object.

  • Is there a possibility to convert each Feature now into a Geometry? I want to have only the data which are in the extension of the feature – Alexi Oct 14 '19 at 13:06

Thank you very much. This helps me a lot. But now I need each Feature as a Polygon because I want to search for Data in the new Polygon. I always get an Error for the code like: "ImageCollection (Error) Feature, argument 'geometry': Invalid type. Expected: Geometry. Actual: Feature."

Here is my Code

  var bounds_AOI_West = bounds_AOI.filterMetadata("system:index","equals","+5270+8474").first();
  bounds_AOI_West = bounds_AOI_West.set('geo_type', 'Polygon')

  var GeometryWest = ee.Feature(bounds_AOI_West);

  var FIRMS_West = FIRMS_filtered
  .filterDate('2018-01-01', '2018-12-31')

Here is the complete Code link: https://code.earthengine.google.com/8c3d499d59dd499ea496162bcef16965

  • Just change your GeometryWest code to add the .geometry() at the end. /////////// var GeometryWest = ee.Feature(bounds_AOI_West).geometry(); – Sean Roulet Oct 14 '19 at 13:21

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.