Getting started with using GEE for analysing earth observation data doesn't have to be painful! In this video I'll show you how to load and visualise Sentinel-2 data based on date, location, and cloud coverage. This is a follow on from my video showing how to load Landsat data - see • Loading Landsat 8 data into Google Earth E...
The code that I'm using in the video is below
// Let’s define the image collection we are working with by writing this command.
// We are creating a new variable 'image' that will come from the L8 collection we have imported
var image = ee.Image(S2
// We will then include a filter to get only images in the date range we are interested in
.filterDate("2019-07-01", "2021-10-30")
// Next we include a geographic filter to narrow the search to images at the location of our ROI point
.filterBounds(ROI)
// Next we will also sort the collection by a metadata property, in our case cloud cover is a very useful one
.sort("CLOUD_COVERAGE_ASSESSMENT")
// Now lets select the first image out of this collection - i.e. the most cloud free image in the date range
.first());
// And let's print the image to the console.
print("A Sentinel scene:", image);
// Define visualization parameters in a JavaScript dictionary for true colour rendering.
// Bands 4,3, and 2 are needed for RGB (true colour composite).
var trueColour = {
bands: ["B4", "B3", "B2"],
min: 0,
max: 3000
};
// Define visualization parameters in a JavaScript dictionary for true colour rendering.
// Bands 8,4,3 are needed for RGB (false colour composite).
var falseColour = {
bands: ["B8", "B4", "B3"],
min: 0,
max: 3000
};
// Centre the scene to the ROI
Map.centerObject(ROI, 12);
// Add the image to the map, using the visualization parameters.
Map.addLayer(image, trueColour, "true-colour image");
// Add the image to the map, using the visualization parameters.
Map.addLayer(image, falseColour, "false-colour image");