# How do I compute the forest area for different regions?

I am currently struggling to compute the forest area of some regions. I am an absolute beginner with Google Earth Engine. I tried it 2 different ways, mostly by copying and editing code I found.

1. Count the number of pixels with a tree cover greater than 10% (using the Hansen data) I thought that, I then could simply multiply by the pixel size and get the area. However, I am not sure if I can do it like that. Nonetheless, here is my code:
``````    var gfc2017 = ee.Image('UMD/hansen/global_forest_change_2017_v1_5');
var treeCover = gfc2017.select(['treecover2000']).unitScale(10, 100);

treeCover,
{palette: ['000000', '00FF00'] });

// import the District layers as a fusion table
var districts = ee.FeatureCollection('ft:13cHA4yautjvngKSaPywzP9Li9FVtlkJ7Dg64DQMG');
//add districts to the map and center map
Map.centerObject(districts);

// Count the pixels with tree cover over 10 percent
var stats = treeCover.reduceRegions({
collection: districts,
reducer: ee.Reducer.count(),
scale: 30
});
//print('count of pixels representing forest in each circle:', stats)

print('pixels representing forest: ', stats);
``````

1. My second approach was to try using a map that has pixels of forest area, non forest area and water of the year 2010 (ID:JAXA/ALOS/PALSAR/YEARLY/FNF/2010)

I tried to sum the pixels, however, I am not able to just look at forest pixels. I guess it is pretty easy to do. But reading here and googling a lot has not helped yet.

My code (without the selection of only forest pixels):

`````` // Load the image from the archive
var farea = ee.Image('JAXA/ALOS/PALSAR/YEARLY/FNF/2010')

var treeCover = farea

// import the District layers as a fusion table
var districts = ee.FeatureCollection('ft:13cHA4yautjvngKSaPywzP9Li9FVtlkJ7Dg64DQMG');
//add districts to the map and center map
Map.centerObject(districts);

// Sum the values of forest pixels in districts.
var areaImage = farea.multiply(ee.Image.pixelArea());

// Count forest pixels in districts
var stats = areaImage.reduceRegions({
collection: districts,
reducer: ee.Reducer.count(),
scale: 30
});
``````

Would be really great if someone could help me out.

So I managed to do it myself by reading more on here (someone had a comparable question about tree cover) and thinking :D For the Hansen data, this code worked for me:

``````//Select the area with tree cover greater than 10%
var treeCover = gfc2017.select(['treecover2000']);
var greater10 = treeCover.gte(10);