הצטרפויות הפוכות
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
נניח שהמטרה של השילוב היא לשמור את כל התמונות באוסף primary
שלא נמצאות באוסף secondary
. אפשר לבצע את סוג המיזוג ההפוך הזה באמצעות ee.Join.inverted()
.
Code Editor (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'
});
// Define the join.
var invertedJoin = ee.Join.inverted();
// Apply the join.
var invertedJoined = invertedJoin.apply(primary, secondary, filter);
// Print the result.
print('Inverted join:', invertedJoined);
הגדרת Python
בדף
סביבת Python מפורט מידע על Python API ועל השימוש ב-geemap
לפיתוח אינטראקטיבי.
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')
# Define the join.
inverted_join = ee.Join.inverted()
# Apply the join.
inverted_joined = inverted_join.apply(primary, secondary, filter)
# Print the result.
display('Inverted join:', inverted_joined)
הפלט אמור להיראות כך:
Image LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140403 (17 bands)
Image LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140419 (17 bands)
השילוב ההפוך מכיל את התמונות מ-3 באפריל ומ-19 באפריל, ומציין את התמונות שנמצאות באוסף primary
אבל לא באוסף secondary
.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[[["\u003cp\u003e\u003ccode\u003eee.Join.inverted()\u003c/code\u003e allows you to keep images from a primary collection that do not have matching images in a secondary collection based on a specified filter.\u003c/p\u003e\n"],["\u003cp\u003eThis example demonstrates how to use \u003ccode\u003eee.Join.inverted()\u003c/code\u003e to identify Landsat 8 images from April that are not present in the May to July timeframe.\u003c/p\u003e\n"],["\u003cp\u003eAn \u003ccode\u003eee.Filter.equals()\u003c/code\u003e is employed to define matching criteria between the collections, typically using a common property like 'system:index'.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting collection contains only images unique to the primary collection, effectively isolating images not found in the secondary collection.\u003c/p\u003e\n"]]],["The content demonstrates how to use `ee.Join.inverted()` to retain images from a `primary` collection that are absent in a `secondary` collection. It involves loading a Landsat 8 image collection and defining `primary` (April-June) and `secondary` (May-July) collections. An equals filter is used to match images by their system index. The `invertedJoin` is defined and applied, resulting in images present in the `primary` but not in the `secondary` collection, exemplified by images from April 3rd and 19th.\n"],null,["# Inverted Joins\n\nSuppose that the purpose of the join is to retain all images in the `primary`\ncollection that are not in the `secondary` collection. You can perform this\ntype of inverted join using `ee.Join.inverted()`.\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 8 image collection at a point of interest.\nvar collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterBounds(ee.Geometry.Point(-122.09, 37.42));\n\n// Define start and end dates with which to filter the collections.\nvar april = '2014-04-01';\nvar may = '2014-05-01';\nvar june = '2014-06-01';\nvar july = '2014-07-01';\n\n// The primary collection is Landsat images from April to June.\nvar primary = collection.filterDate(april, june);\n\n// The secondary collection is Landsat images from May to July.\nvar secondary = collection.filterDate(may, july);\n\n// Use an equals filter to define how the collections match.\nvar filter = ee.Filter.equals({\n leftField: 'system:index',\n rightField: 'system:index'\n});\n\n// Define the join.\nvar invertedJoin = ee.Join.inverted();\n\n// Apply the join.\nvar invertedJoined = invertedJoin.apply(primary, secondary, filter);\n\n// Print the result.\nprint('Inverted join:', invertedJoined);\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Load a Landsat 8 image collection at a point of interest.\ncollection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA').filterBounds(\n ee.Geometry.Point(-122.09, 37.42)\n)\n\n# Define start and end dates with which to filter the collections.\napril = '2014-04-01'\nmay = '2014-05-01'\njune = '2014-06-01'\njuly = '2014-07-01'\n\n# The primary collection is Landsat images from April to June.\nprimary = collection.filterDate(april, june)\n\n# The secondary collection is Landsat images from May to July.\nsecondary = collection.filterDate(may, july)\n\n# Use an equals filter to define how the collections match.\nfilter = ee.Filter.equals(leftField='system:index', rightField='system:index')\n\n# Define the join.\ninverted_join = ee.Join.inverted()\n\n# Apply the join.\ninverted_joined = inverted_join.apply(primary, secondary, filter)\n\n# Print the result.\ndisplay('Inverted join:', inverted_joined)\n```\n\nThe output should look something like: \n\n```\nImage LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140403 (17 bands)\nImage LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140419 (17 bands)\n```\n\nThe inverted join contains the images from April 3 and April 19, indicating the images\nthat are present in the `primary` collection but not in the\n`secondary` collection."]]