सामान्य जॉइन, primary
कलेक्शन के उन एलिमेंट को दिखाता है जो secondary
कलेक्शन के किसी भी एलिमेंट से मैच करते हैं. यह मैच, फ़िल्टर में दी गई मैच की शर्त के हिसाब से होता है. आसानी से शामिल होने के लिए, ee.Join.simple()
का इस्तेमाल करें. यह अलग-अलग कलेक्शन के बीच आम एलिमेंट ढूंढने या एक कलेक्शन को दूसरे के हिसाब से फ़िल्टर करने के लिए मददगार हो सकता है. उदाहरण के लिए, दो इमेज कलेक्शन लें जिनमें (हो सकता है कि) कुछ मैच करने वाले एलिमेंट हों. यहां “मैच करने वाले” एलिमेंट का मतलब, फ़िल्टर में बताई गई शर्त से है. उदाहरण के लिए, मान लें कि मैच करने का मतलब है कि इमेज आईडी एक जैसे हैं. दोनों कलेक्शन में मिलती-जुलती इमेज एक जैसी हैं. इसलिए, मिलती-जुलती इमेज का यह सेट ढूंढने के लिए, जॉइन का इस्तेमाल करें:
कोड एडिटर (JavaScript)
// Load a Landsat 8 image collection at a point of interest. var collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA') .filterBounds(ee.Geometry.Point(-122.09, 37.42)); // Define start and end dates with which to filter the collections. var april = '2014-04-01'; var may = '2014-05-01'; var june = '2014-06-01'; var july = '2014-07-01'; // The primary collection is Landsat images from April to June. var primary = collection.filterDate(april, june); // The secondary collection is Landsat images from May to July. var secondary = collection.filterDate(may, july); // Use an equals filter to define how the collections match. var filter = ee.Filter.equals({ leftField: 'system:index', rightField: 'system:index' }); // Create the join. var simpleJoin = ee.Join.simple(); // Apply the join. var simpleJoined = simpleJoin.apply(primary, secondary, filter); // Display the result. print('Simple join: ', simpleJoined);
import ee import geemap.core as geemap
Colab (Python)
# Load a Landsat 8 image collection at a point of interest. collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterBounds( ee.Geometry.Point(-122.09, 37.42) ) # Define start and end dates with which to filter the collections. april = '2014-04-01' may = '2014-05-01' june = '2014-06-01' july = '2014-07-01' # The primary collection is Landsat images from April to June. primary = collection.filterDate(april, june) # The secondary collection is Landsat images from May to July. secondary = collection.filterDate(may, july) # Use an equals filter to define how the collections match. filter = ee.Filter.equals(leftField='system:index', rightField='system:index') # Create the join. simple_join = ee.Join.simple() # Apply the join. simple_joined = simple_join.apply(primary, secondary, filter) # Display the result. display('Simple join:', simple_joined)
पिछले उदाहरण में, देखें कि शामिल किए जाने वाले कलेक्शन, समय के हिसाब से एक महीने तक ओवरलैप होते हैं. ध्यान दें कि यह जॉइन लागू होने पर, आउटपुट एक ऐसा ImageCollection
होगा जिसमें primary
कलेक्शन में मौजूद सिर्फ़ मैच होने वाली इमेज होंगी. आउटपुट कुछ ऐसा दिखेगा:
Image LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140505 (17 bands) Image LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140521 (17 bands)
इस आउटपुट से पता चलता है कि primary
और secondary
कलेक्शन में, 5 मई और 21 मई की दो इमेज मैच करती हैं.