پیوندهای ساده
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک اتصال ساده عناصری را از مجموعه primary
برمی گرداند که با هر عنصری در مجموعه secondary
مطابق با شرایط مطابقت در فیلتر مطابقت دارند. برای انجام یک اتصال ساده، از ee.Join.simple()
استفاده کنید. این ممکن است برای یافتن عناصر مشترک در میان مجموعه های مختلف یا فیلتر کردن یک مجموعه توسط مجموعه دیگر مفید باشد. به عنوان مثال، دو مجموعه تصویر را در نظر بگیرید که (ممکن است) دارای عناصر منطبق باشند، جایی که "تطابق" با شرایط مشخص شده در یک فیلتر تعریف می شود. به عنوان مثال، اجازه دهید تطبیق به این معنی باشد که شناسه های تصویر برابر هستند. از آنجایی که تصاویر منطبق در هر دو مجموعه یکسان هستند، از یک join ساده برای کشف این مجموعه از تصاویر منطبق استفاده کنید:
ویرایشگر کد (جاوا اسکریپت)
// 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);
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
# 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 می مطابقت دارند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eSimple joins return elements from a primary collection that match elements in a secondary collection based on a specified filter condition.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.Join.simple()\u003c/code\u003e is used to perform a simple join, which can be helpful for identifying common elements or filtering collections.\u003c/p\u003e\n"],["\u003cp\u003eThe output of a simple join is a new collection containing only the matching elements from the primary collection, retaining its original structure.\u003c/p\u003e\n"],["\u003cp\u003eAn example use case is finding overlapping images between two image collections with different date ranges, by matching their image IDs.\u003c/p\u003e\n"]]],["A simple join, using `ee.Join.simple()`, identifies matching elements between a `primary` and `secondary` collection based on a specified filter. This is done by defining a match condition, such as equal image IDs using `ee.Filter.equals()`. The join is applied to these collections, then the result is a new `ImageCollection` containing only the matching images from the `primary` collection. An example is the matching images in landsat collection at may 5 and may 21.\n"],null,["# Simple Joins\n\nA simple join returns elements from the `primary` collection that match any\nelement in the `secondary` collection according to the match condition in the\nfilter. To perform a simple join, use an `ee.Join.simple()`. This might\nbe useful for finding the common elements among different collections or filtering\none collection by another. For example, consider two image collections which (might)\nhave some matching elements, where \"matching\" is defined by the condition specified in\na filter. For example, let matching mean the image IDs are equal. Since the matching\nimages in both collections are the same, use a simple join to discover this set of\nmatching images:\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// Create the join.\nvar simpleJoin = ee.Join.simple();\n\n// Apply the join.\nvar simpleJoined = simpleJoin.apply(primary, secondary, filter);\n\n// Display the result.\nprint('Simple join: ', simpleJoined);\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# Create the join.\nsimple_join = ee.Join.simple()\n\n# Apply the join.\nsimple_joined = simple_join.apply(primary, secondary, filter)\n\n# Display the result.\ndisplay('Simple join:', simple_joined)\n```\n\nIn the previous example, observe that the collections to join temporally overlap by about\na month. Note that when this join is applied, the output will be an\n`ImageCollection` with only the matching images in the `primary`\ncollection. The output should look something like: \n\n```\nImage LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140505 (17 bands)\nImage LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140521 (17 bands)\n```\n\nThis output shows that two images match (as specified in the filter) between the\n`primary` and `secondary` collections, images at May 5 and May 21."]]