Here is my code in GEE:

var CO = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CO')
         .filterDate('2018-07-04', '2018-07-05')

var CO_merged = CO.toList(CO.size());

var CO_1 = ee.Image(CO_merged.get(0));

var fireCount = ee.ImageCollection('MODIS/006/MOD14A1')

var Fire = fireCount.select('FireMask').gte(8);

var CO_fire = CO_1.updateMask(Fire);

Map.setCenter(20,-8, 8);

Map.addLayer(CO_fire, {palette:'red'}, 'data1');

Here is my new layer: enter image description here

My questions:

I want to get the red region (Masked by Fire) CO columns and the latitude and longitude information, finally export this red region data and geographic information about these red areas. so how can I get this information in GEE?

1 Answer 1


This can be done by first defining a area in which you want to obtain the geometries of the red regions. I made a rectangle somewhere in the region you displayed the map. Then, you label every individual connected 'red' area with a different label using connectedComponents. You can then apply reduceToVectors and export those vectors for example as KMZ files you could preview in Google Earth. Note the variability in regions which are made by varying the scale parameter in reduceToVectors.

// Make an area of interest
var AOI = ee.Geometry.Rectangle([[18.0957, -7.0066],[20.9247, -7.8209]]);

// give every 'red' region a single label
var labelled = CO_fire.toInt().connectedComponents(ee.Kernel.rectangle(3, 3, 'pixels'), 256);
// reduce the image to vectors 
var toVectors = labelled.select('labels').reduceToVectors({geometry: AOI, scale: 50, labelProperty: 'labels', maxPixels: 10e8, geometryInNativeProjection: true});

// export the vectors
Export.table.toDrive({collection: toVectors, 
                      description: 'exportTask', 
                      folder: 'StackExchangeQuestion', 
                      fileFormat: 'KMZ'});

Here there is a link to the full code. Next time please add descriptive text to your code to make it readable for others.

  • Thanks a lot,if my interesting area is global, and the resolution is 0.05°×0.05°, how to calculate the sum number of fire where happened in one grid and export these data? Really appropriated your help.
    – Xun
    Feb 18, 2019 at 13:22

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.