Preview:
// Define the coordinates for the specific point (e.g., the location of interest)
var point = ee.Geometry.Point(90.2611485521762, 23.44690280909043);

// Create a buffer around the point (e.g., 30 kilometers)
var bufferRadius = 30000; // 30 km in meters
var pointBuffer = point.buffer(bufferRadius);

// Create a Landsat 8 Collection 2 Tier 1 image collection for the desired date range
var startDate = '2020-12-01';
var endDate = '2020-12-31';

var landsatCollection2 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
  .filterBounds(point)
  .filterDate(startDate, endDate);

// Cloud masking function for Landsat
function maskL8Clouds(image) {
  var qa = image.select('QA_PIXEL');
  var cloudMask = qa.bitwiseAnd(1 << 3).eq(0); // Cloud bit is 3rd
  return image.updateMask(cloudMask);
}

// Apply the cloud mask to the collection
var cloudFreeCollection = landsatCollection2.map(maskL8Clouds);

// Print the number of images in the collection
var imageCount = cloudFreeCollection.size();
print('Number of cloud-free images in the collection:', imageCount);

// Compute the average temperature across all cloud-free images (Band 10 - thermal infrared)
var averageTemperature = cloudFreeCollection.select('B10').mean();

// Convert temperature from Kelvin to Celsius
var temperatureCelsius = averageTemperature.subtract(273.15);

// Clip the temperature image to the buffer region around the point
var clippedTemperature = temperatureCelsius.clip(pointBuffer);

// Inspect the temperature range (min and max values) within the buffer region
var temperatureStats = clippedTemperature.reduceRegion({
  reducer: ee.Reducer.minMax(),
  geometry: pointBuffer,
  scale: 30
});
print('Temperature range (Celsius):', temperatureStats);

// Display the specific point and the clipped temperature layer on the map
Map.centerObject(point, 10);
Map.addLayer(point, {color: 'red'}, 'Specific Point');

// Adjust visualization based on the inspected temperature range
Map.addLayer(
  clippedTemperature,
  {
    min: 10, // Adjust these values after checking the printed temperature range
    max: 40, // Adjust these values after checking the printed temperature range
    palette: ['blue', 'lightblue', 'green', 'yellow', 'red']
  },
  'Clipped Land Surface Temperature (Celsius)',
  false,
  0.75 // Set transparency to help with visibility
);

// Add a legend to the map
var legend = ui.Panel({
  style: {
    position: 'bottom-right',
    padding: '8px 15px'
  }
});
legend.add(ui.Label({
  value: 'Average Land Surface Temperature (°C)',
  style: {
    fontWeight: 'bold',
    fontSize: '14px',
    margin: '0 0 4px 0',
    padding: '0'
  }
}));

// Define the color palette and temperature ranges for the legend
var palette = ['blue', 'lightblue', 'green', 'yellow', 'red'];
var tempRanges = ['10-15 °C', '16-20 °C', '21-25 °C', '26-30 °C', '31-40 °C'];

// Add the colors and labels to the legend
for (var i = 0; i < palette.length; i++) {
  var colorBox = ui.Label({
    style: {
      backgroundColor: palette[i],
      padding: '8px',
      margin: '0 0 4px 0'
    }
  });
  var description = ui.Label({
    value: tempRanges[i],
    style: {margin: '0 0 4px 6px'}
  });
  legend.add(
    ui.Panel({
      widgets: [colorBox, description],
      layout: ui.Panel.Layout.Flow('horizontal')
    })
  );
}

// Add the legend to the map
Map.add(legend);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter