ee.Dictionary.toImage

사전의 값에서 상수 이미지를 만듭니다. 이미지의 밴드는 names 인수에 따라 순서가 지정되고 이름이 지정됩니다. 이름을 지정하지 않으면 밴드가 영숫자순으로 정렬됩니다.

사용반환 값
Dictionary.toImage(names)이미지
인수유형세부정보
다음과 같은 경우: dictionary딕셔너리변환할 사전입니다.
names목록, 기본값: null출력 밴드의 순서입니다.

코드 편집기 (JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

var selectedKeysImg = dict.toImage(['B1', 'B2']);
print('Selected keys image band names', selectedKeysImg.bandNames());

var allKeysImg = dict.toImage();
print('All keys image band names', allKeysImg.bandNames());

Python 설정

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

import ee
import geemap.core as geemap

Colab (Python)

# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
    'B1': 182,
    'B2': 219,
    'B3': 443
})

selected_keys_img = dic.toImage(['B1', 'B2'])
print('Selected keys image band names:',
      selected_keys_img.bandNames().getInfo())

all_keys_img = dic.toImage()
print('All keys image band names:', all_keys_img.bandNames().getInfo())