मिलती-जुलती सुविधाओं के ग्रुप को FeatureCollection
में जोड़ा जा सकता है, ताकि पूरे सेट पर फ़िल्टर करने, क्रम से लगाने, और रेंडर करने जैसे अन्य काम किए जा सकें.
सुविधाओं के कलेक्शन में, सामान्य सुविधाओं (ज्यामिति + प्रॉपर्टी) के अलावा,
अन्य कलेक्शन भी शामिल हो सकते हैं.
FeatureCollection
कंस्ट्रक्टर
FeatureCollection
बनाने का एक तरीका यह है कि कॉन्स्ट्रक्टर को सुविधाओं की सूची दी जाए. यह ज़रूरी नहीं है कि सुविधाओं का ज्यामिति टाइप या
प्रॉपर्टी एक जैसी हों. उदाहरण के लिए:
कोड एडिटर (JavaScript)
// Make a list of Features. var features = [ ee.Feature(ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {name: 'Voronoi'}), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {name: 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {name: 'Dirichlet'}) ]; // Create a FeatureCollection from the list and print it. var fromList = ee.FeatureCollection(features); print(fromList);
import ee import geemap.core as geemap
Colab (Python)
# Make a list of Features. features = [ ee.Feature( ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {'name': 'Voronoi'} ), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {'name': 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {'name': 'Dirichlet'}), ] # Create a FeatureCollection from the list and print it. from_list = ee.FeatureCollection(features) display(from_list)
अलग-अलग ज्यामिति को सिर्फ़ एक Feature
के FeatureCollection
में भी बदला जा सकता है:
कोड एडिटर (JavaScript)
// Create a FeatureCollection from a single geometry and print it. var fromGeom = ee.FeatureCollection(ee.Geometry.Point(16.37, 48.225)); print(fromGeom);
import ee import geemap.core as geemap
Colab (Python)
# Create a FeatureCollection from a single geometry and print it. from_geom = ee.FeatureCollection(ee.Geometry.Point(16.37, 48.225)) display(from_geom)
टेबल डेटासेट
Earth Engine में कई तरह के टेबल डेटासेट होस्ट किए जाते हैं. टेबल डेटासेट लोड करने के लिए, FeatureCollection
कन्स्ट्रक्टर को टेबल आईडी दें. उदाहरण के लिए, RESOLVE इकोरिजन का डेटा लोड करने के लिए:
कोड एडिटर (JavaScript)
var fc = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017'); Map.setCenter(12.17, 20.96, 3); Map.addLayer(fc, {}, 'ecoregions');
import ee import geemap.core as geemap
Colab (Python)
fc = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017') m = geemap.Map() m.set_center(12.17, 20.96, 3) m.add_layer(fc, {}, 'ecoregions') display(m)
ध्यान दें कि इमेज डेटासेट की तरह ही, टेबल डेटासेट को भी Earth Engine डेटा कैटलॉग में खोजा जा सकता है.
रैंडम सैंपल
किसी खास इलाके में, रैंडम पॉइंट का कलेक्शन पाने के लिए, इनका इस्तेमाल किया जा सकता है:
कोड एडिटर (JavaScript)
// Define an arbitrary region in which to compute random points. var region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064); // Create 1000 random points in the region. var randomPoints = ee.FeatureCollection.randomPoints(region); // Display the points. Map.centerObject(randomPoints); Map.addLayer(randomPoints, {}, 'random points');
import ee import geemap.core as geemap
Colab (Python)
# Define an arbitrary region in which to compute random points. region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064) # Create 1000 random points in the region. random_points = ee.FeatureCollection.randomPoints(region) # Display the points. m = geemap.Map() m.center_object(random_points) m.add_layer(random_points, {}, 'random points') display(m)