Replace mask with -9999

Because -9999 often works better than 0 for a DEM

Follow this link or copy the code below.

// Specify Country names
var country_names = ['Indonesia'];

// Get the country boundaries
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');

// Filter for country
var Indonesia = countries.filter(ee.Filter.inList('Country', country_names));

// Get the geometry
var Indonesia = Indonesia.geometry();

// Get the bounds
var IndonesiaBounds = Indonesia.bounds();

// create the vizualization parameters
var viz = {min:0.0, max:1000, palette:"1400f7,00f4e8,f4f000,f40000,960424"};

// add the country boundaries to the map

// add the bounds

// replace the mask by -9999
var mask = dem.mask()
var demMap = ee.Image(-9999).where(mask, dem)

// add to map
Map.addLayer(demMap.clip(IndonesiaBounds),viz,"Clipped DEM");
//Export the image, specifying scale and region.
image: demMap,
description: 'IndonesiaNoData',
scale: 1000,
region: IndonesiaBounds

Leave a Reply