An imperative function that returns a map id and token, suitable for generating a Map overlay.

Returns an object which may be passed to or ui.Map.addLayer, including an additional 'image' field, containing a Collection.draw image wrapping a FeatureCollection containing this feature. Undefined if a callback was specified.

FeatureCollection.getMap(visParams, callback)MapId|Object
this: featurecollectionFeatureCollectionThe FeatureCollection instance.
visParamsObject, optionalThe visualization parameters. Currently only one parameter, 'color', containing an RGB color string is allowed. If vis_params isn't specified, then the color #000000 is used.
callbackFunction, optionalAn async callback. If not supplied, the call is made synchronously.


Code Editor (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);

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