Sentinel-2 cloud free mosaic of Europe in one minute with Google Earth Engine

Cloud-free Sentinel-2 mosaic of Europe

Today I am going to give you a short introduction into the Google Earth Engine and show you how to create a cloud free mosaic of Europe using Sentinel-2 data in just one minute! Yes, literally one minute!

The Google Earth Engine is a “computing platform that allows users to run geospatial analysis on Google’s infrastructure.” This means that you don’t have to download any data yourself and that you can perform high speed data analysis of all kinds of available satellite imagery on your laptop, computer or even your cell phone if you wish by using the computantional power of Google.

1. Sign up at

No worries, it’s free of charge if you are a researcher or simply want to explore the possibilities and power of the Google Earth Engine. However if you want to use it for commercial purposes, you should get in touch with Goolge first.

2. Go to

Google Earth Engine offers a couple of interfaces. In our case study we are going to use the code editor interface. Via this interface you can make us of a variety of already existing code chunks which will help you with your analysis and the processing of all kinds of satellite imagery. You can find a short intro into the Google Earth Engine API here.

The following illustration shows the main features of the code editor:

Google Earth Engine Code Editor (by Google)

Google Earth Engine Code Editor (Illustration by Google)

3. Select an existing script from the script manager

From the script manager on the left side select “Filtered Composite”. This script takes an polygon extent as an input:

var polygon = ee.Geometry.Polygon([[
 [-109.05, 37.0], [-102.05, 37.0], [-102.05, 41.0], // colorado
 [-109.05, 41.0], [-111.05, 41.0], [-111.05, 42.0], // utah
 [-114.05, 42.0], [-114.05, 37.0], [-109.05, 37.0]]]);

And then selects all available Landsat 7 scenens from April 2000 until July 2000:

var collection = ee.ImageCollection('LE7_L1T')
 .filterDate('2000-04-01', '2000-07-01')

In a third step the median of all of these images is calculated and displayed to the map:

// Select the median pixel.
var median = collection.median();

// Select the red, green and blue bands.
var result ='B3', 'B2', 'B1');
Map.addLayer(result, {gain: '1.4, 1.4, 1.1'});
Map.setCenter(-110, 40, 5);

The result is a Landsat 7 mosaic over Colorado and Denver. You can execute the code by clicking the “Run” button. It takes only a couple of seconds to compute! Amazing!

4. Pushing the limits – Europe Sentinel-2 cloud free. How long will it take?

Let’s test how long the same procedure will take for the entire continent of Europe. And lets use Sentinel-2 instead!
Any guess how long it will take? Here are the code adaptations I have made:

Polygon over Europe:

var geometry = /* color: #d63000 */ee.Geometry.Polygon( [[[-26.60888671875, 66.01801815922043], 
[-18.1494140625, 32.565333160841035], [15.954649288064843, 35.39010560236367], [44.80224609375, 36.756490329505176], 
[43.59375, 70.85188122123132], [11.88720703125, 73.23937702441908]]]);

var polygon = geometry;

This time we want Sentinel-2 data, so let’s change “LE7_L1T” to “COPERNICUS/S2” and specify the time frame to April 2016 until December 2016:

Voila! We are done! How long did it take? About a minute!! Wow, stunning! Here the result:

Cloud-free Sentinel-2 mosaic of Europe

Cloud-free Sentinel-2 mosaic of Europe


About This Author

Martin was born in Czech Republic and studied at the University of Natural Resources and Life Sciences, Vienna. He is currently working at an Earth Observation Company in Austria, specialised in Land Monitoring. His main interests are: Open-source applications like R, (geospatial) statistics and data-management, web-mapping and visualization. He loves travelling, geocaching, photography and TV series.


You can post comments in this post.

  • Hi Great work, congrats!

    Can i use this code for Indian region?


    RAJ KUMAR SINGH 1 month ago Reply

    • Thanks! You can use it for any region. You just need to adapt the extent of the polygon variable.

      Martin 1 month ago Reply

  • By taking the minimum value an issue is that you get the cloud shadows.

    Simon 1 month ago Reply

    • Hey Simon! Thanks for the comment!
      You are absolutely right! The post is meant as a proof of concept and shows the computantional potential of GEE which is stunning.
      For an entirely cloud- and shadow free mosaic a more advanced algorithm is of course needed. 😉
      However, I was still stunned that “min” performed that well. I was expecting many more artefacts!!


      BTW: I am a big fan of your blog and your work at “series temporelles”

      Martin 1 month ago Reply

Post A Reply