단순 조인은 필터의 일치 조건에 따라 secondary
컬렉션의 요소와 일치하는 primary
컬렉션의 요소를 반환합니다. 간단한 조인을 실행하려면 ee.Join.simple()
를 사용하세요. 이는 여러 컬렉션 간에 공통적인 요소를 찾거나 한 컬렉션을 다른 컬렉션으로 필터링하는 데 유용할 수 있습니다. 예를 들어 일치하는 요소가 있을 수 있는 두 이미지 모음을 생각해 보세요. 여기서 '일치'는 필터에 지정된 조건으로 정의됩니다. 예를 들어 일치하는 것은 이미지 ID가 동일하다는 것을 의미합니다. 두 컬렉션의 일치하는 이미지는 동일하므로 간단한 조인을 사용하여 일치하는 이미지 세트를 찾습니다.
코드 편집기 (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)
이전 예시에서 조인할 컬렉션은 시간적으로 약 한 달 정도 겹칩니다. 이 조인이 적용되면 primary
컬렉션에서 일치하는 이미지만 포함된 ImageCollection
가 출력됩니다. 출력은 다음과 같이 표시됩니다.
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월 5일 및 5월 21일 이미지) 간에 두 이미지가 일치함을 보여줍니다(필터에 지정됨).