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
Map.addLayer(Indonesia,null,"Boundaries");

// add the bounds
Map.addLayer(IndonesiaBounds,null,"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.
Export.image.toDrive({
image: demMap,
description: 'IndonesiaNoData',
scale: 1000,
region: IndonesiaBounds
});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s