ImageCollection 개요

ImageCollection는 이미지의 스택 또는 시퀀스입니다. Earth Engine 애셋 ID를 ImageCollection 생성자에 붙여넣어 ImageCollection를 로드할 수 있습니다. ImageCollection ID는 데이터 카탈로그에서 찾을 수 있습니다. 예를 들어 Sentinel-2 표면 반사율 컬렉션을 로드하려면 다음을 실행합니다.

코드 편집기 (JavaScript)

var sentinelCollection = ee.ImageCollection('COPERNICUS/S2_SR');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

sentinel_collection = ee.ImageCollection('COPERNICUS/S2_SR')

이 컬렉션에는 공개 카탈로그의 모든 Sentinel-2 이미지가 포함되어 있습니다. 많습니다. 일반적으로 여기 또는 여기에 표시된 대로 컬렉션을 필터링합니다.

Earth Engine 컬렉션 ID를 사용하여 ImageCollection를 로드하는 것 외에도 Earth Engine에는 이미지 컬렉션을 만드는 메서드가 있습니다. 생성자 ee.ImageCollection() 또는 편의 메서드 ee.ImageCollection.fromImages()는 이미지 목록에서 이미지 컬렉션을 만듭니다. 기존 컬렉션을 병합하여 새 이미지 컬렉션을 만들 수도 있습니다. 예를 들면 다음과 같습니다.

코드 편집기 (JavaScript)

// Create arbitrary constant images.
var constant1 = ee.Image(1);
var constant2 = ee.Image(2);

// Create a collection by giving a list to the constructor.
var collectionFromConstructor = ee.ImageCollection([constant1, constant2]);
print('collectionFromConstructor: ', collectionFromConstructor);

// Create a collection with fromImages().
var collectionFromImages = ee.ImageCollection.fromImages(
  [ee.Image(3), ee.Image(4)]);
print('collectionFromImages: ', collectionFromImages);

// Merge two collections.
var mergedCollection = collectionFromConstructor.merge(collectionFromImages);
print('mergedCollection: ', mergedCollection);

// Create a toy FeatureCollection
var features = ee.FeatureCollection(
  [ee.Feature(null, {foo: 1}), ee.Feature(null, {foo: 2})]);

// Create an ImageCollection from the FeatureCollection
// by mapping a function over the FeatureCollection.
var images = features.map(function(feature) {
  return ee.Image(ee.Number(feature.get('foo')));
});

// Print the resultant collection.
print('Image collection: ', images);

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

# Create arbitrary constant images.
constant_1 = ee.Image(1)
constant_2 = ee.Image(2)

# Create a collection by giving a list to the constructor.
collection_from_constructor = ee.ImageCollection([constant_1, constant_2])
display('Collection from constructor:', collection_from_constructor)

# Create a collection with fromImages().
collection_from_images = ee.ImageCollection.fromImages(
    [ee.Image(3), ee.Image(4)]
)
display('Collection from images:', collection_from_images)

# Merge two collections.
merged_collection = collection_from_constructor.merge(collection_from_images)
display('Merged collection:', merged_collection)

# Create a toy FeatureCollection
features = ee.FeatureCollection(
    [ee.Feature(None, {'foo': 1}), ee.Feature(None, {'foo': 2})]
)

# Create an ImageCollection from the FeatureCollection
# by mapping a function over the FeatureCollection.
images = features.map(lambda feature: ee.Image(ee.Number(feature.get('foo'))))

# Display the resultant collection.
display('Image collection:', images)

이 예에서는 FeatureCollection에 대해 Image를 반환하는 함수를 매핑하여 ImageCollection가 생성됩니다. ImageCollection 섹션에 대한 매핑에서 매핑에 대해 자세히 알아보세요. FeatureCollection 섹션에서 지형지물 컬렉션에 대해 자세히 알아보세요.

Cloud Storage의 GeoTiff에서 ImageCollection를 만들 수도 있습니다. 예를 들어 다음과 같습니다.

코드 편집기 (JavaScript)

// All the GeoTiffs are in this folder.
var uriBase = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +
    'LC08_L1GT_001002_20160817_20170322_01_T2/';

// List of URIs, one for each band.
var uris = ee.List([
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B2.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B3.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B4.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF',
]);

// Make a collection from the list of images.
var images = uris.map(ee.Image.loadGeoTIFF);
var collection = ee.ImageCollection(images);

// Get an RGB image from the collection of bands.
var rgb = collection.toBands().rename(['B2', 'B3', 'B4', 'B5']);
Map.centerObject(rgb);
Map.addLayer(rgb, {bands: ['B4', 'B3', 'B2'], min: 0, max: 20000}, 'rgb');

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

# All the GeoTiffs are in this folder.
uri_base = (
    'gs://gcp-public-data-landsat/LC08/01/001/002/'
    + 'LC08_L1GT_001002_20160817_20170322_01_T2/'
)

# List of URIs, one for each band.
uris = ee.List([
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B2.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B3.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B4.TIF',
    uri_base + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF',
])

# Make a collection from the list of images.
images = uris.map(lambda uri: ee.Image.loadGeoTIFF(uri))
collection = ee.ImageCollection(images)

# Get an RGB image from the collection of bands.
rgb = collection.toBands().rename(['B2', 'B3', 'B4', 'B5'])
m = geemap.Map()
m.center_object(rgb)
m.add_layer(rgb, {'bands': ['B4', 'B3', 'B2'], 'min': 0, 'max': 20000}, 'rgb')
m

Cloud GeoTiff에서 이미지를 로드하는 방법 자세히 알아보기