Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Urban Classified Script

//Urban Classified Script
//by Monja Sebela

var NDWI=index(B03,B08); 
var NDVI=index(B08, B04);
var BareSoil=2.5 *((B11 + B04)-(B08 + B02))/((B11 + B04)+(B08 + B02));
if (NDWI > 0.2) {
 return [0, 0.5, 1]
if (NDVI>0.2){
  return [0, 0.3*NDVI, 0]
else {
 return [BareSoil, 0.2, 0]

General description of the script

The script uses the NDWI, NDVI, BarrenSoil and B11 to differntiate between water, built up areas, barren areas and vegetated areas. In the script, water is colored blue, vegetation green, built up areas white, barren soil brown and all other pixels dark green. All pixels with NDWI values greater than 0.2 are considered to be water; all other pixels with B11 values greater than 0.8 OR NDVI values lower than 0.1 to be built up; all other pixels with NDVI values greater than 0.2 to be vegetation (returnint NDVI in the green channel) and all other pixels to be barren soil or else (returnint BareSoil index in the red channel and dark green in the green channel.). The script does a good job (although not perfect) at separating barren soil from buildings, which is often an issuewith urban scripts. It is thus most valuable in arid regions, where most other visualizations fail to distinguish buildings from the surrounding sand or soil. The script fails at differentiating between buildings and vegetation in dense alternating between houses and yards in for example, suburbs of Baltimore.



Urban Classified script (right) in Temara, Morocco. This example showcases the usefulness of the script in differentiating bare ground from buildings.



Urban Classified script (right) in Baltimore, USA. This example showcases the shortcomings of the script in differentiating buildings from vegetation in suburbs of Baltimore.



Urban Classified script (right) in Taizhou, China.


Author of the script

Monja Ĺ ebela