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.

I cannot calculate the area covered by each pixel. I searched on Google and the available methods use band values, what I need is to find the area covered by urban/water/vegetation based on spectral end-member values that are been defined.

If anyone has the idea on how to perform it please share and if possible suggest an idea to export it into a graph.

Here is a link to the script:


EDIT: my aim to find the growth of an urban area or loss of vegetation in a region over the years. The urban area is indicated in red colour when you run the script.

I am finding how much area is covered by urban area so that I could measure the growth of the region.

I'm fairly new to Earth Engine.

  • Isn't pixel size an essential element of the metadata? It should be provided to you.
    – jcarlson
    Mar 12, 2018 at 17:24
  • Nice UI, but little spatial analysis, where do you want to use pixel area? what for? you should update the question and give more information about what you want to do. Mar 13, 2018 at 11:30
  • 1
    I'm a little unclear what your goal ist. Do you want to determine (sub)pixel area with spectral unmixing? Or are you trying to perform a pixel-wise classification and then derive the area from that. Your question contains both - however the code only shows unmixing to different endmembers.
    – Kersten
    Mar 13, 2018 at 15:33

1 Answer 1


Unwinding all the UI stuff, which is irrelevant to your question:

var blrROI = ee.Geometry.Point(77.5909, 12.9791);

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

var image11 = ee.Image(ee.ImageCollection('LANDSAT/LT05/C01/T1')

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 = image11.unmix([urban, veg, water], true, true)
    .rename(['urban', 'veg', 'water']);

Map.centerObject(blrROI, 13);
Map.addLayer(fractions, {}, 'fractions');
var blrPoly = blrROI.buffer(5000);
Map.addLayer(blrPoly, {}, 'blrPoly');

// The following are all in square meters.
var pixelAreas = fractions.multiply(ee.Image.pixelArea());
var totalAreas = pixelAreas.reduceRegion('sum', blrPoly, 30);

You're going to need to watch out for clouds here. Also, note that I've constrained the unmixing results to [0,1].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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