Reputation: 160
As you know for visualizing an image we should set RGB using bands key of an JavaScript object and then feed that object to Map.addLayer as second argument.
// Load an image.
var image = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140318');
// Define the visualization parameters.
var vizParams = {
bands: ['B5', 'B4', 'B3'],
};
I wonder if it is possible to set that based on band numbers instead of names. because when we process an image, its bandnames get changed(usually some kind of prefix or suffix is added to the band names during some procedures). something like this :
// Define the visualization parameters.
var vizParams = {
bands: [5, 4, 3],
};
cause if we can set Red Green Blue channels based on band number (instead of band names) then we can define the visualization object once and then use that for ever!
thanks in advence!
Upvotes: 1
Views: 677
Reputation: 4613
I suppose you could do something like
var vizParams = {
bands: image.select(5,4,3).bandNames().getInfo(),
};
Upvotes: 0