[GIS] Calculate the area covered by a pixel in Google Earth Engine

google-earth-apigoogle-earth-engine

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:

https://code.earthengine.google.com/d5e7c1435a160524404878c6e2110bda

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.

Best Answer

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')
    .filterBounds(blrROI)
    .sort('CLOUD_COVER')
    .first())
    .select(bands);

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);
print(totalAreas);

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

Related Question