Forest mapping

Map forests for the period 2000 – 2017

step 1: add your aoi

// set the area of interest
var chl = ee.FeatureCollection("users/servirmekong/Vietnam/CHL_Boundary").geometry();

step 2: import the tree canopy cover and tree height

// import tree height
var th  = ee.ImageCollection("projects/servir-mekong/yearly_primitives_smoothed/tree_height");
// import tree canopy cover
var cc = ee.ImageCollection("projects/servir-mekong/yearly_primitives_smoothed/tree_canopy");

step 3: Set forest definitions

// Forest definitions
// Tree canopy greater than (%)
var ccThreshold = 10;
// Tree height greater than (meters)
var thThreshold = 5;
// minimum mapping unit
var mmu = 5;

step 4: Set time period

// set year of interest
var year = 2017;
var startDate = ee.Date.fromYMD(year,1,1);
var endDate = ee.Date.fromYMD(year,12,31);

step 5: filter for time

// get image for the year
var thImage = ee.Image(th.filterDate(startDate,endDate).first());
var ccImage = ee.Image(cc.filterDate(startDate,endDate).first());

step 6: Create boolean maps for treeheight and canopy cover using the thresholds

// Set the thresholds of the image
var treeheight = thImage.gt(thThreshold);
var canopy = ccImage.gt(ccThreshold);

step 7: Create boolean maps for treeheight and canopy cover using the thresholds

// create the forest layer
var forest = treeheight.add(canopy).eq(2)
forest = forest.mask(forest)

// add the forest layer to the map
Map.addLayer(forest.clip(chl),{palette:"darkgreen"},"Forests without minimum mapping unit");

step 8: Add the minimum mapping unit for the final map

// apply the minimum mapping unit
var map = forest.connectedPixelCount(mmu+2).gte(mmu);
Map.addLayer(map.updateMask(map).clip(chl),{palette:"darkgreen"},"Forests with minimum mapping unit");

Find the example here

Advertisements

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s