ee.FeatureCollection.map

컬렉션에 알고리즘을 매핑합니다.

매핑된 컬렉션을 반환합니다.

사용반환 값
FeatureCollection.map(algorithm, dropNulls)컬렉션
인수유형세부정보
다음과 같은 경우: collection컬렉션컬렉션 인스턴스입니다.
algorithm함수컬렉션의 이미지 또는 지형지물에 매핑할 작업입니다. 이미지 또는 기능을 수신하고 하나를 반환하는 JavaScript 함수입니다. 이 함수는 한 번만 호출되고 결과는 설명으로 캡처되므로 명령형 작업을 실행하거나 외부 상태에 의존할 수 없습니다.
dropNulls불리언, 선택사항true인 경우 매핑된 알고리즘이 null을 반환할 수 있으며 null을 반환하는 요소는 삭제됩니다.

코드 편집기 (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Function to convert power plant capacity from megawatts to gigawatts and
// add the value as a new feature property.
var mwToGw = function(feature) {
  var megawatt = feature.getNumber('capacitymw');
  var gigawatt = megawatt.divide(1000);
  return feature.set('capacitygw', gigawatt);
};

// Apply the function to each feature in the collection.
fc = fc.map(mwToGw);

print('Note the new "capacitygw" property in each feature', fc);

Python 설정

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

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

# Function to convert power plant capacity from megawatts to gigawatts and
# add the value as a new feature property.
def mw_to_gw(feature):
  megawatt = feature.getNumber('capacitymw')
  gigawatt = megawatt.divide(1000)
  return feature.set('capacitygw', gigawatt)

# Apply the function to each feature in the collection.
fc = fc.map(mw_to_gw)

print('Note the new "capacitygw" property in each feature:', fc.getInfo())