/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var countries = ee.FeatureCollection("FAO/GAUL/2015/level0"),
    glo30 = ee.ImageCollection("projects/sat-io/open-datasets/GLO-30");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
print('GLO-30 Collection size :',glo30.size())

//Explanation on setting default Projection here https://twitter.com/jstnbraaten/status/1494038930643042309
var elev = glo30.mosaic().setDefaultProjection('EPSG:3857',null,30)

//you can also use this incase you don't want to specify CRS
//var elev = glo30.mosaic().setDefaultProjection(glo30.first().projection())


// Create an "ocean" variable to be used for cartographic purposes
var ocean = elev.lte(0);

// Create a custom elevation palette from hex strings.
var elevationPalette = ['006600', '002200', 'fff700', 'ab7634', 'c4d0ff', 'ffffff'];

// Use these visualization parameters, customized by location.
var visParams = {min: 1, max: 3000, palette: elevationPalette};

// Create a mosaic of the ocean and the elevation data
var visualized = ee.ImageCollection([
  // Mask the elevation to get only land
  elev.mask(ocean.not()).visualize(visParams), 
  // Use the ocean mask directly to display ocean.
  ocean.mask(ocean).visualize({palette:'000022'})
]).mosaic();

// Note that the visualization image doesn't require visualization parameters.
Map.addLayer(visualized.clip(countries), {}, 'elev palette');