Last active
January 22, 2025 17:08
-
-
Save jscarto/599914ac223f21fc45a2 to your computer and use it in GitHub Desktop.
Pan-sharpen and display a Landsat 8 scene in Google Earth Engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Band combinations | |
var natural = ['B4', 'B3', 'B2']; | |
var swir = ['B6', 'B5', 'B3']; | |
var urban = ['B7', 'B6', 'B4']; | |
var veg = ['B5', 'B4', 'B3']; | |
// Get a Landsat scene | |
var scene = ee.Image('LANDSAT/LC8_L1T_TOA/LC80450332015263LGN00'); | |
// Convert the RGB bands to the HSV | |
var hsv = scene.select(urban).rgbToHsv(); | |
// Add band 8 and convert back to RGB | |
var sharpened = ee.Image.cat([ | |
hsv.select('hue'), hsv.select('saturation'), scene.select('B8') | |
]).hsvToRgb(); | |
// Do a very basic color correction | |
var imageRGB = sharpened.visualize({min: 0, max:0.18, | |
gamma:[ | |
1.05, // red | |
1.08, // green | |
0.8] // blue | |
}); | |
// Display the image and zoom to it | |
Map.addLayer(imageRGB); | |
Map.centerObject(sharpened, 9); |
Hello, I tried to do for Landsat 7 using the same approach but I cant seem to get a collection of images that has a unique ID like yours. How do I pan sharpen a Landsat 7 image?
Thank you in advance
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sentinel-2 does not have a panchromatic band, so this code will not work. It is specific to Landsat 8.