Tutorial 6.2

2. Script structure

2.2. Display properties

Below code snippet set some display settings for the web app. 

  • Set default background to Satellite
  • Define a palette for elevation data
  • Center the map at landing page to center of your study area
  • Mosaic and clip elevation (dsm) layer to your study area
  • Add the elevation layer to the layer list for the final app.

// Below line set the default background map to Google satellite

Map.setOptions('HYBRID');

// Below line set the default cursor style to crosshair (better to pin point pixel)

Map.style().set('cursor''crosshair');

 

// What we are interested is the first band - DSM

// Let us set a palette to visualize this elevation

var elevPalette = ['yellow''green''Brown'];

var elev = {min: 1000max: 3000palette: elevPalette};

 

// But we are only interested to see our study area

// See above that the ULB boundary is aleady imported above as variable 'ulb'

Map.centerObject(ulb,8);

 

//Now let us select the first band 'DSM' and mosaic & clip the DSM to ULB boundary

var dsm_ulb = dsm.select('DSM').filterBounds(ulb).mosaic().clip(ulb);

print(dsm_ulb);

 

// The below command will add clipped DSM to the map view

Map.addLayer(dsm_ulbelev'Elevation (ALOS)');