Tracé un ráster en Google Earth Engine, con una paleta de colores, y creé una leyenda como se muestra.
// Pull the package from the GitHub repo which stores colour palettes to be used in GEE // See https://github.com/gee-community/ee-palettes for mroe info var palettes = require('users/gena/packages:palettes'); // Choose the yellow, orange, red colour palette with 9 classes var palette = palettes.colorbrewer.YlOrRd[9]; var vis = {min: 0, max: 335, palette: palette}; // Add a raster layer and enable the colour palette Map.addLayer(image, {min: 0, max: 335, palette: palette}); // Creates a color bar thumbnail image for use in legend from the given color palette function makeColorBarParams(palette) { return { bbox: [0, 0, 1, 0.1], dimensions: '100x10', format: 'png', min: 0, max: 1, palette: palette, }; } // Create the colour bar for the legend var colorBar = ui.Thumbnail({ image: ee.Image.pixelLonLat().select(0), 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: 'Carbon (tons C)', style: {fontWeight: 'bold'} }); // Add the legendPanel to the map var legendPanel = ui.Panel([legendTitle, colorBar, legendLabels]); Map.add(legendPanel);Todo lo relacionado con este mapa resulta como me gustaría, sin embargo, incluye valores 0 en mi paleta de colores, lo que idealmente no debería.
¿Hay alguna manera de convertir los valores 0 en blanco manteniendo mi paleta de colores actual?