ee.FeatureCollection.getMap

지도 오버레이를 생성하는 데 적합한 지도 ID와 토큰을 반환하는 명령형 함수입니다.

이 특성이 포함된 FeatureCollection을 래핑하는 Collection.draw 이미지가 포함된 추가 'image' 필드를 비롯하여 ee.data.getTileUrl 또는 ui.Map.addLayer에 전달될 수 있는 객체를 반환합니다. 콜백이 지정된 경우 정의되지 않습니다.

사용반환 값
FeatureCollection.getMap(visParams, callback)MapId|Object
인수유형세부정보
다음과 같은 경우: featurecollectionFeatureCollectionFeatureCollection 인스턴스입니다.
visParams객체, 선택사항시각화 매개변수입니다. 현재 RGB 색상 문자열이 포함된 'color' 매개변수 하나만 허용됩니다. vis_params가 지정되지 않으면 색상 #000000이 사용됩니다.
callback함수(선택사항)비동기 콜백입니다. 제공되지 않으면 호출이 동기적으로 이루어집니다.

코드 편집기 (JavaScript)

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

// Get MapId for styled FeatureCollection.
var mapId = fc.getMap({color: '800080'});
print('mapId for styled FeatureCollection', mapId);

// MapId can be used as an input to Map.addLayer to display the layer.
Map.setCenter(4.56, 50.78, 7);
Map.addLayer(mapId);

// MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
print('URL for zoom level 6 tile that includes majority of points',
      ee.data.getTileUrl(mapId, 32, 21, 6));

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"'
)

# Get MapId for styled FeatureCollection.
map_id = fc.getMapId({'color': '800080'})
display('map_id for FeatureCollection', map_id)

# MapId can be used as an input to geemap.Map.add_layer to display the layer.
m = geemap.Map()
m.set_center(4.56, 50.78, 7)
m.add_layer(map_id['image'])
display(m)

# MapId can be used as an input to ee.data.getTileUrl to fetch map tiles.
display(
    'URL for zoom level 6 tile that includes majority of points',
    ee.data.getTileUrl(map_id, 32, 21, 6),
)