This question already has an answer here:

3 down vote favorite I am doing a project on calculating the growth of urban areas in different cities located in different parts of India. I have been able to classify the area into urban, vegetation and water. Now the problem is I cannot calculate the area covered by each pixel. I searched on Google and the available methods uses band values, what I need is to find the area covered by urban/water/vegetation based on spectral end member values that is been defined. If anyone has idea on how to perform it please share and if possible suggest an idea to export it into a graph. What I need is to find the area covered by the different spectral endmembers (urban,veg,water) values which has been defined.

Here is a link to the script:


I'm fairly new to Earth Engine so my knowledge is quite limited, please excuse

marked as duplicate by Kersten, BERA, tinlyx, whyzar, Vince Apr 8 '18 at 0:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Please edit your old question instead of pasting the content into a new one. – Kersten Apr 7 '18 at 20:25

First, you have not classified the area, you estimated the proportions of the three endmembers per pixel, which is somewhat different. To get the area of each class in a pixel, multiply the proportions by a pixel area image (each pixel stores its area in square meters). To make that computation sane, I recommend constraining your unmixing to non-negative and sum-to-one fractions (2nd and 3rd parameters of unmix()). Here is a much simplified example:

var bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'];

var image = ee.Image('LANDSAT/LT05/C01/T1/LT05_144051_19880119')
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], min: 0, max: 128}, 'image');

var urban = [88, 42, 48, 38, 86, 115, 59];
var veg = [50, 21, 20, 35, 50, 110, 23];
var water = [51, 20, 14, 9, 7, 116, 4];

var fractions = image.unmix([urban, veg, water], true, true)
    .rename(['urban', 'veg', 'water']);
Map.addLayer(fractions, {}, 'unmixed');

var area = ee.Image.pixelArea();
Map.addLayer(area, {}, 'area', false);

var areasPerPixel = fractions.multiply(area);
Map.addLayer(areasPerPixel, {min: 0, max: 1300}, 'areasPerPixel');

var areasPerRegion = areasPerPixel.reduceRegion({
  reducer: ee.Reducer.sum(), 
  geometry: region, 
  scale: 30
print('areasPerRegion', areasPerRegion);

Note that this example produces a map of endmember area per pixel and a dictionary of total area of each endmember in a geometry called region. Areas are in square meters.

Not the answer you're looking for? Browse other questions tagged or ask your own question.