ee.FeatureCollection.flatten

कलेक्शन के कलेक्शन को फ़्लैट करता है.

इस्तेमालरिटर्न
FeatureCollection.flatten()FeatureCollection
आर्ग्यूमेंटटाइपविवरण
यह: collectionFeatureCollectionकलेक्शन का इनपुट कलेक्शन.

उदाहरण

कोड एडिटर (JavaScript)

// Counties in New Mexico, USA.
var counties = ee.FeatureCollection('TIGER/2018/Counties')
                   .filter('STATEFP == "35"');

// Monthly climate and climatic water balance surfaces for January 2020.
var climate = ee.ImageCollection('IDAHO_EPSCOR/TERRACLIMATE')
                  .filterDate('2020-01', '2020-02');

// Calculate mean climate variables for each county per climate surface
// time step. The result is a FeatureCollection of FeatureCollections.
var countiesClimate = climate.map(function(image) {
  return image.reduceRegions({
    collection: counties,
    reducer: ee.Reducer.mean(),
    scale: 5000,
    crs: 'EPSG:4326'
  });
});

// Note that a printed FeatureCollection of FeatureCollections is not
// recursively expanded, you cannot view metadata of the features within the
// nested collections until you isolate a single collection or flatten the
// collections.
print('FeatureCollection of FeatureCollections', countiesClimate);

print('Flattened FeatureCollection of FeatureCollections',
      countiesClimate.flatten());

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# Counties in New Mexico, USA.
counties = ee.FeatureCollection('TIGER/2018/Counties').filter('STATEFP == "35"')

# Monthly climate and climatic water balance surfaces for January 2020.
climate = ee.ImageCollection('IDAHO_EPSCOR/TERRACLIMATE').filterDate(
    '2020-01', '2020-02')

# Calculate mean climate variables for each county per climate surface
# time step. The result is a FeatureCollection of FeatureCollections.
def reduce_mean(image):
  return image.reduceRegions(**{
      'collection': counties,
      'reducer': ee.Reducer.mean(),
      'scale': 5000,
      'crs': 'EPSG:4326'
      })
counties_climate = climate.map(reduce_mean)

# Note that a printed FeatureCollection of FeatureCollections is not
# recursively expanded, you cannot view metadata of the features within the
# nested collections until you isolate a single collection or flatten the
# collections.
print('FeatureCollection of FeatureCollections:', counties_climate.getInfo())

print('Flattened FeatureCollection of FeatureCollections:',
      counties_climate.flatten().getInfo())