공지사항:
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증해야 합니다.
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())
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003emap()\u003c/code\u003e iterates over a FeatureCollection, applying a user-defined function to each feature.\u003c/p\u003e\n"],["\u003cp\u003eThe provided function transforms features and returns modified versions, creating a new FeatureCollection.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003emap()\u003c/code\u003e allows adding/modifying properties of features within a FeatureCollection or performing calculations based on existing properties.\u003c/p\u003e\n"],["\u003cp\u003eAn optional \u003ccode\u003edropNulls\u003c/code\u003e parameter controls whether features resulting in null from the mapping function are retained in the output.\u003c/p\u003e\n"]]],["The `map` algorithm applies a user-defined function to each element within a collection (e.g., features or images). This function, which accepts an element as input and returns a modified one, is applied to each item of the collection. The `dropNulls` argument allows filtering null return values. The result is a new collection containing the modified elements. For example, converting power plant capacity units and adding them as a new property to the features.\n"],null,["# ee.FeatureCollection.map\n\n\u003cbr /\u003e\n\nMaps an algorithm over a collection.\n\n\u003cbr /\u003e\n\nReturns the mapped collection.\n\n| Usage | Returns |\n|---------------------------------------------------|------------|\n| FeatureCollection.map`(algorithm, `*dropNulls*`)` | Collection |\n\n| Argument | Type | Details |\n|--------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `algorithm` | Function | The operation to map over the images or features of the collection. A JavaScript function that receives an image or features and returns one. The function is called only once and the result is captured as a description, so it cannot perform imperative operations or rely on external state. |\n| `dropNulls` | Boolean, optional | If true, the mapped algorithm is allowed to return nulls, and the elements for which it returns nulls will be dropped. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\n// Function to convert power plant capacity from megawatts to gigawatts and\n// add the value as a new feature property.\nvar mwToGw = function(feature) {\n var megawatt = feature.getNumber('capacitymw');\n var gigawatt = megawatt.divide(1000);\n return feature.set('capacitygw', gigawatt);\n};\n\n// Apply the function to each feature in the collection.\nfc = fc.map(mwToGw);\n\nprint('Note the new \"capacitygw\" property in each feature', fc);\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# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\n\n# Function to convert power plant capacity from megawatts to gigawatts and\n# add the value as a new feature property.\ndef mw_to_gw(feature):\n megawatt = feature.getNumber('capacitymw')\n gigawatt = megawatt.divide(1000)\n return feature.set('capacitygw', gigawatt)\n\n# Apply the function to each feature in the collection.\nfc = fc.map(mw_to_gw)\n\nprint('Note the new \"capacitygw\" property in each feature:', fc.getInfo())\n```"]]