0

I want to replicate the following image, which pixel-wise tells (look at the legend) how many images are available in a ee.ImageCollection.

https://i.stack.imgur.com/BgoMR.png [1]

I thank you for any help in advance!

References: [1] Masoud Mahdianpari, Bahram Salehi, Fariba Mohammadimanesh, Brian Brisco, Saeid Homayouni, Eric Gill, Evan R. DeLancey & Laura Bourgeau-Chavez (2020) Big Data for a Big Country: The First Generation of Canadian Wetland Inventory Map at a Spatial Resolution of 10-m Using Sentinel-1 and Sentinel-2 Data on the Google Earth Engine Cloud Computing Platform, Canadian Journal of Remote Sensing, 46:1, 15-33, DOI: 10.1080/07038992.2019.1711366[enter image description here]

S22
  • 1

1 Answers1

0

If you use geemap Python package you can use geemap.image_count function and Map.add_colorbar method to add a colorbar. If you use JavaScript code editor you could use the code below which is derived and modified from geemap repo and you could check this out for adding a colorbar:

// Acquire Sentinel-2 Image Collection
var collection = ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')

// Get one band's name
var band = collection.first().bandNames().get(0)

// Generate desired image where each pixel value represents the number of Images in the Image Collection
var image = collection.filterBounds(geometry)
                      .filterDate('2017-01-01', '2020-04-15')
                      .filter(ee.Filter.listContains("system:band_names", band))
                      .select([band])
                      .reduce(ee.Reducer.count())
                      .clip(geometry)
var vis = {"min":0,"max":900,"palette":["00FFFF","0000FF"]}
Map.addLayer(image, vis, 'NDWI')
KostasVlachos
  • 121
  • 1
  • 5