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),
)