Mangrove Detection Using Landsat 8 and Google Earth Engine (Study Case: Kabupaten Bekasi)

Bagas A
8 min readJan 4, 2023

--

Photo by Waranont (Joe) on Unsplash

Mangroves are a group of trees and shrubs that live in coastal areas, generally contain salt and react with anaerobic soil. Maybe some of us are a bit confused when we meet the terms mangroves and bakau. In fact, mangroves are all trees, both wood and vines that are able to live adapted to coastal ecosystems, while bakau or Rhizophora sp. is one of the constituent species of mangroves. Generally, mangroves have 3 zones, each of which grows certain types of plants. The Front Zone is generally planted with plants with supporting roots to strengthen trees from the brunt of big waves, the Middle Zone is usually grown with plants adapted to breath roots to be able to live in mud and the Back Zone is generally grown with types of plants that are able to adapt to plank roots. [1]

In 1980, the area of ​​mangroves in Indonesia was estimated at 4.200.000 ha and by 2005 it had shrunk until only 2.900.000 ha remained and was shrinking by a percentage of 1,24% or an estimated 52.000 ha of mangroves were lost from Indonesian territory per year. [2] This relates to development in coastal areas, expansion of ponds and excessive logging of mangroves, and waste that damages coastal ecosystems which continues to this day. Of course this cause big impact to the world, as one of the carbon-rich forests in the tropics, and other functions as a place to live for several marine biota, as a barrier to abrasion, as a barrier to seawater intrusion and pollutant materials in coastal waters, of course the reduction of mangroves can give an impact in destroying the balance of coastal and even marine ecosystems, thus exacerbating the impact of abrasion. [3]

Kabupaten Bekasi as one of the regencies located in northern Java, some of its territory is in the coastal area, one of which is Kecamatan Muara Gembong which also has mangrove in several of its areas. This article tries to look at the changes that have occurred in the mangrove area in Kabupaten Bekasi in the last 10 years, in a time series starting in 2013, 2018 and 2022 using one of the remote sensing tools: Google Earth Engine (GEE) with Landsat 8 imagery. As an initial note, this article using the CMRI (Combined Mangrove Recognition Index) formula. [4]

  • First of all, we need to import the dataset: Landsat 8 Collection 2 Tier 1 TOA Reflectance by writing Landsat 8 in the search field.
Importing dataset (Landsat 8) — 1
  • The dataset will be imported with the name ImageCollection, I renamed it as L8 to make it simpler.
Importing dataset (Landsat 8) — 2
  • Define the area by creating a polygon by selecting ‘draw a rectangle’ at the top left of the map layout. Then, I renamed it as Area.
Defining Area
  • Brace yourself, we are going to write the script. Before that, I will give the formula that will be used:
CMRI Fromula (Gupta, et al, 2018) [4]
  • As can be seen, the bands that we will use include band 3 (green), band 4 (red) and band 5 (NIR). It should be noted, the following is the index arrangement of the Landsat 8 bands found in GEE, B3 (green) has index 2, B4 (red) has index 3 and B5 (NIR) has index 4. Therefore, the formula to be used can be seen in the //CMRI Formula (NDVI-NDWI) section.
Landsat 8 bands in GEE
  • The data I used is the median of a full year filtering dataset (January 1st — December 31st) with dataset criteria: cloud cover < 15. You can see the full script below.
//CMRI 2022

var image2022 =
// define area
L8.filterBounds(Area)
// filtering dataset with cloud cover < 15
.filterMetadata('CLOUD_COVER','less_than',15)
// filter date
.filterDate('2022-01-01','2022-12-31').median()
// clip
.clip(Area)

// CMRI Formula (NDVI-NDWI)
var CMRI2022 = image2022.expression('((b(4)-b(3))/(b(4)+b(3)))-((b(2)-b(4))/(b(2)+b(4)))')

// Adding Layer dan Define Classification
Map.addLayer(CMRI2022, {min:-1, max:1, palette:['blue', 'yellow', 'green', 'red']}, 'CMRI 2022');
  • Do the same for 2018 and 2013, pay attention to the filter date section.
    The following is a script for 2018 analysis.
 //CMRI 2018

var image2018 =
// define area
L8.filterBounds(Area)
// filtering dataset with cloud cover < 15
.filterMetadata('CLOUD_COVER','less_than',15)
// filter date
.filterDate('2018-01-01','2018-12-31').median()
// clip
.clip(Area)

// CMRI Formula (NDVI-NDWI)
var CMRI2018 = image2018.expression('((b(4)-b(3))/(b(4)+b(3)))-((b(2)-b(4))/(b(2)+b(4)))')

// Adding Layer dan Define Classification
Map.addLayer(CMRI2018, {min:-1, max:1, palette:['blue', 'yellow', 'green', 'red']}, 'CMRI 2018');
  • The following is a script for analysis for 2013. Because Landsat 8 was launched on February 11th 2013, we will use that as the starting date.
//CMRI 2013

var image2013 =
// define area
L8.filterBounds(Area)
// filtering dataset with cloud cover < 15
.filterMetadata('CLOUD_COVER','less_than',15)
// filter date
.filterDate('2013-02-11','2013-12-31').median()
// clip
.clip(Area)

// CMRI Formula (NDVI-NDWI)
var CMRI2013 = image2013.expression('((b(4)-b(3))/(b(4)+b(3)))-((b(2)-b(4))/(b(2)+b(4)))')

// Adding Layer dan Define Classification
Map.addLayer(CMRI2013, {min:-1, max:1, palette:['blue', 'yellow', 'green', 'red']}, 'CMRI 2013');
  • This is the result, there will be 3 layers appear: CMRI 2013, CMRI 2018 and CMRI 2022 according to what we have made above.
Result — 1
  • To make it way cooler, I will add the Kabupaten Bekasi’s village administration polygon (shp). The first thing to do is go to the Asset — New — Shape files — then select the shapefile that we will upload (extensions in the form of .shp, .shx, .dbf, .prj or you can also use .zip files). After successfully importing, I named it as polygon.
Importing Shapefile
  • To display the imported shapefile, you can see the script I used below.
//Admin Desa Polygon

var admin_desa = ee.FeatureCollection(polygon)

var styling = {
color: 'black',
width: 0.7,
lineType: 'dotted',
fillColor: '#ffffff00'}

Map.addLayer(admin_desa.style(styling), {}, 'Admin Desa');
  • The next is to display the village name (nama desa) label from the shapefile. Here, I use packages from Gennadii Donchyts. Here is the script.
//Label

var text = require('users/gena/packages:text')

var scale = Map.getScale() + 1

var labels = admin_desa.map(function(feat){
feat = ee.Feature(feat)
var name = ee.String(feat.get("DESA"))
var centroid = feat.geometry().centroid()
var t = text.draw(name, centroid, scale, {
fontSize: 14,
textColor: 'white',
outlineWidth: 1,
outlineColor: 'black'
})
return t
})

var labels_final = ee.ImageCollection(labels)
Map.addLayer(labels_final, {}, 'Label')
  • The last step is to add a legend to our analysis layout map to display the classification of the results of the analysis that we have done.
// Adding Legend

var panel = ui.Panel({
style: {
position: 'bottom-left',
padding: '5px;'
}
})

var title = ui.Label({
value: 'Classification',
style: {
fontSize: '15px',
fontWeight: 'bold',
margin: '1px;'
}
})

panel.add(title)

var color =['blue', 'yellow', 'green', 'red']
var classification = ['Water','Land','Non-Mangrove Vegetation','Mangrove']

var list_legend = function(color, desc) {
var c = ui.Label({
style: {
backgroundColor: color,
padding: '10px',
margin: '4px'
}
})
var ds = ui.Label({
value: desc,
style: {
margin: '5px'
}
})
return ui.Panel({
widgets: [c, ds],
layout: ui.Panel.Layout.Flow('horizontal')
})
}

for (var i = 0; i < 4; i++) {
panel.add(list_legend(color[i], classification[i]));
}

Map.add(panel);
  • This is the result.
Result — 2

Based on the results of the analysis above, there are several points that we can take.

  • The mangrove area is the red color and is in the coastal area. The red color that is scattered in the middle is another land use, this can be the same color because the recorded color spectral has similarities to the mangroves.
CMRI Analysis output that we did before (Final Result)
  • In the map above it can be seen that from year to year there was an increase in the area of ​​mangroves. In the white box area, it can be seen that there was an increase in the area of ​​mangrove areas at these three areas between 2013 and 2018, namely in Desa Pantai Bahagia at the north, parts of the Desa Pantai Sederhana and Desa Pantaimekar, as well as in the border area between Desa Pantai Harapanjaya and Desa Huripjaya at the west.
  • Then, in 2018 and 2022 there was an increase in the area of ​​mangroves although not too significant. There are at least two areas that show an increase in area (blue box), namely in the border area between Desa Pantai Harapanjaya and Desa Huripjaya and a small part at the north of Desa Segaramakmur and Desa Pantaimakmur.
  • This is in accordance with research by Maulani, et al (2021) [5] which shows that there was an increase in the area of ​​mangroves in Kabupaten Bekasi, especially in Kecamatan Muara Gembong in the 2009–2019 period by up to 66%. This article tries to show one of the functions of remote sensing as a tool that can be used to provide an initial overview of research, of course to get more comprehensive results field validation and more in-depth research are needed.

You can access the full script on this link below and also the asset I used (Administrasi Desa Kabupaten Bekasi — BIG2016):

https://code.earthengine.google.com/0e67d5c11997a4f62bd436c02cb06a6f

https://code.earthengine.google.com/?asset=projects/bagasanin00/assets/AdminDesa_KabBekasi

References:

[1] : https://pgsp.big.go.id/meluruskan-istilah-hutan-mangrove-bukan-hutan-bakau/

[2] https://www.cifor.org/knowledge/publication/5669/

[3] https://www.cifor.org/knowledge/publication/3773/

[4] Gupta, K., Mukhopadhyay, A., Giri, S., Chanda, A., Datta Majumdar, S., Samanta, S., Mitra, D., Samal, R. N., Pattnaik, A. K., & Hazra, S. (2018). An index for discrimination of mangroves from non-mangroves using LANDSAT 8 OLI imagery. MethodsX, 5(September), 1129–1139. https://doi.org/10.1016/j.mex.2018.09.011

[5] Maulani, A., Taufiq, N., & Praktikto, I. (2021). Perubahan Lahan Mangrove di Pesisir Muara Gembong, Bekasi, Jawa Barat. Journal of Marine Research, 55–63.

--

--