// Define a point of interest. Use the UI Drawing Tools to import a point // geometry and name it "point" or set the point coordinates with the // ee.Geometry.Point() function as demonstrated here. var Boundary = Boundary // Import the Landsat 8 TOA image collection. var l8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA'); // Get the least cloudy image. var image = ee.Image( l8.filterBounds(Boundary) .filterDate('2021-01-01', '2025-12-31') .sort('CLOUD_COVER') .first() ); // Compute the Normalized Difference Vegetation Index (NDVI). var nir = image.select('B5'); var red = image.select('B4'); var ndvi = nir.subtract(red).divide(nir.add(red)).rename('NDVI'); // Display the result. Map.centerObject(Boundary); var ndviParams = {min: -1, max: 1, palette: ['blue', 'white', 'green']}; Map.addLayer(ndvi, ndviParams, 'NDVI image'); Map.addLayer(Boundary, {color: 'Red'}, 'RSPB Dove Stone Boundary') // Legend var palette = ["white", "green"] var vis = {min: -1, max: 1, palette: palette}; var nSteps = 15 // Creates a color bar thumbnail image for use in legend from the given color palette function makeColorBarParams(palette) { return { bbox: [0, 0, nSteps, 0.1], dimensions: '100x10', format: 'png', min: 0, max: nSteps, palette: palette, }; } // Create the colour bar for the legend var colorBar = ui.Thumbnail({ image: ee.Image.pixelLonLat().select(0).int(), params: makeColorBarParams(vis.palette), style: {stretch: 'horizontal', margin: '0px 8px', maxHeight: '24px'}, }); // Create a panel with three numbers for the legend var legendLabels = ui.Panel({ widgets: [ ui.Label(vis.min, {margin: '4px 8px'}), ui.Label( ((vis.max-vis.min) / 2+vis.min), {margin: '4px 8px', textAlign: 'center', stretch: 'horizontal'}), ui.Label(vis.max, {margin: '4px 8px'}) ], layout: ui.Panel.Layout.flow('horizontal') }); // Legend title var legendTitle = ui.Label({ value: 'NDVI', style: {fontWeight: 'bold'} }); // Add the legendPanel to the map var legendPanel = ui.Panel([legendTitle, colorBar, legendLabels]); Map.add(legendPanel); //Print ![[DS_NDVI.jpg]] #Coding #Research #GEE