I am currently working with a raster file which shows peatlands in the Congo Basin and the ESA/CCI/FireCCI/5_1 image collection (images for each month between 2001-2019). My end goal is to create visual thumbnails of seasonal (blocks of 3 months) burn area over the peatlands and charts, as well as derive inter-annual trends between the same three months across all years.

Current challenge: I have tried to use the multiply operator between the fire image collection and the peatlands image and it doesn't work between an image and an image collection. I am trying to create a new fire image collection over the peatlands only.

A pixel value of 1 indicates peat in the peatlands image and I have reclassified the fire image collection so that 1 indicates land cover that has been burnt.

Annotated code developed so far below:

//Add layers
GretaMap_extent = ee.FeatureCollection("users/n/Vector_peats");//vector of extent of peatland map
PeatlandMap_Greta = ee.Image("users/n/peat_nopeat"); //peatland map

// Visualize FireCCI51 from 2001-2019
var dataset = ee.ImageCollection('ESA/CCI/FireCCI/5_1')
                  .filterDate('2001-01-01', '2019-12-31')
                  .map(function(image){return image.clip(GretaMap_extent)}) ;  
var burnedArea = dataset.select('LandCover');//all burned pixels are classified according to LandCover

//Palette for Burn Area
var baVis = {
  min: 0,
  max: 180,
  palette: [
    'ffff64', 'aaf0f0', 'dcf064', 'c8c864', '006400', '00a000', '003c00', '285000', '788200',
    '8ca000', 'be9600', '966400', 'ffb432', 'ffdcd2', 'ffebaf', '009678', '00dc82'

//Palette for peatland map
var peatlandsvis = {
  min: 0,
  max: 1,
  palette: ['white', 'fuchsia']
//only keep pixels with a value of 1 (peat)
var onlyPeat = PeatlandMap_Greta.updateMask(
  PeatlandMap_Greta.neq(0) // Only keep pixels where values don't equal zero

//visualize peat and burn pixels together
Map.setCenter(30, 0, 6.1);
Map.addLayer(burnedArea, baVis, 'Burned Area');
Map.addLayer(onlyPeat, peatlandsvis, 'Peatlands Map');

//Reclassify the LandCover because I'm only interested in the burn pixels, not their land cover
var reclassify = function(image) {
  return image.remap(
    [0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 170, 180],//land cover values
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],//recode all to 1
    null,//mask out all other values, which shouldn't exist anyways 
    'LandCover');//band name
var new_ds = burnedArea.map(reclassify);// new variable which applies reclassification to burnedArea
Map.addLayer(new_ds);//I think this worked. Not sure? 

//Now: how to only show fire on peatlands?


2 Answers 2


Replace "multiply an image collection by an image" with "multiply each image in the image collection by an image" and you already have the tool you need: .map().

var burnedPeat = burnedArea.map(function (burnImage) {
  return burnImage.multiply(onlyPeat);
  • Thank you Kevin! I tweaked your suggestion slightly to address the need to reproject the peatland map to the same scale as the fire data. I have edited my code above.
    – Shona
    Commented Apr 23, 2021 at 9:15
  • @Shona Please don't edit your question to contain the solution rather than the problem — it creates confusion when future readers are trying to make use of questions. Instead, you can post your own answer (yes, that's fine, even if you're picking someone else's answer) with the solution you put together.
    – Kevin Reid
    Commented Apr 23, 2021 at 14:54
  • Hi @Kevin. Sorry about that. I have deleted my additions from my question and added them to the answer section. I hope that's ok.
    – Shona
    Commented Apr 23, 2021 at 16:08
  • @Shona Perfect! Thanks!
    – Kevin Reid
    Commented Apr 23, 2021 at 16:43
  • Hi @Kevin. Are you able to help me out with another question that I posed here: gis.stackexchange.com/questions/395025/…
    – Shona
    Commented Apr 28, 2021 at 8:42

This is the additional code I added to my original code posted above

// projection of final raster: 250m is the resolution of the fire data
var reproj_params = {crs:'EPSG:4326',scale:250}; 
//map the reprojected new_ds fire image collection over the peatlands to see peatland fires only
var burntPeat = new_ds.map(function(image) {
  return image.multiply(onlyPeat.reproject(reproj_params));
Map.addLayer(burntPeat, {palette:'red'}, 'BurntPeat');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.