Computation of NDBI in Google Earth Engine

What is NDBI?

Normalized Difference Built-up Index (NDBI) is a spectral index used to analyze built-up areas. This index uses two bands: the short-wave infrared (SWIR) and the near infrared (NIR). Areas with more built-up structures reflect shortwave-infrared (SWIR) more while areas with less built-up have a low Near-Infrared (NIR) reflectance. NDBI values range from -1 to +1 where the negative values represent areas with no built-up structures and positive values represent highly built-up areas.

This article focuses on step by step computation of NDBI using Sentinel 2 in Google Earth Engine.

Select an Area of Interest

You can choose an area of interest by importing a shapefile of the region you are interested in. To achieve this, proceed as follows:

  1. On the left side panel, click on Assets
  2. A list of your previously ingested tables (shapefiles) will appear
  3. Navigate to your shapefile of interest and click on the arrow to import the shapefile into the script.

Select an image collection.

  1. In this case, an image from Sentinel 2 image collection from Copernicus was used. Perform a filter for the clouds so as to obtain an image with a less cloud cover.
  2. Proceed to perform a filter for the dates, to obtain the date the image was acquired and a filter for bounds to obtain an image for your area of interest.
  3. Reduce the image collection to a single image by calculating the median of the pixel values.
var s2 = ee.ImageCollection(“COPERNICUS/S2”);

var filtered = s2.filter(‘CLOUDY_PIXEL_PERCENTAGE’, 30))
		.filter(‘2019-01-01’,  ‘2019-12-31’))

var image = filtered.mean();
print (image);


Apply a true color visualization to the filtered image. This is achieved using B4, B3, and B2 which are Red, Green and Blue bands respectively.

var rgbVis = {
min: 0.00,
max: 3000,
bands: [‘B4’, ‘B3’, ‘B2’]

Calculate and  Visualize NDBI

The NDBI is calculated using the normalizedDifference() function and bands B11 and B8.

Apply the visualization parameters to the NDBI layer.

var ndbi = image.normalizedDifference([‘B11’, ‘B8’).rename(‘ndbi’);

var ndbiParams = {
min: -1,
max: 1,
palette: [‘cyan’, ‘red’]
Display the Final Result
Map.addLayer(image.clip(table), rgbVis, ‘Image’);
Map.addLayer(ndbi.clip(table), ndbiParams, ‘ndbi’);
Map.centerObject(table, 10);

The area of interest is Nairobi County. We expect the highly built-up areas (in brown) to be around
Central Business District (CBD), Estates and around the slums such as Kibera.
Previous Post
Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.