var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
var hansen = ee.Image("UMD/hansen/global_forest_change_2017_v1_5")
var CAN=countries.filter(ee.Filter.eq('country_na','Canada'))
var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
var hansen = ee.Image("UMD/hansen/global_forest_change_2017_v1_5")
var CAN=countries.filter(ee.Filter.eq('country_na','Canada'))
var lossImage2016=hansen.select(['lossyear']).eq(16)
var areaImage = lossImage2016.multiply(ee.Image.pixelArea())
var lossImage2016=hansen.select(['lossyear']).eq(16)
var areaImage = lossImage2016.multiply(ee.Image.pixelArea())
var areaImageMasked=areaImage.updateMask(areaImage)
Map.addLayer(CAN,{},'Canada') //make the map
Map.addLayer(areaImageMasked,{},'areaImageMasked')
var areaImageMasked=areaImage.updateMask(areaImage)
Map.addLayer(CAN,{},'Canada') //make the map
Map.addLayer(areaImageMasked,{},'areaImageMasked')
var stats = areaImageMasked.reduceRegions({
reducer: ee.Reducer.sum(), //variously, ''sum'' or 'ee.Reducer.sum()' are used in ee documentation
collection: CAN
scale:30, //scale of image pixel size should always be specified, as per guides/reducers_reduce_region
//tileScale:16 //valid tileScale is 1 to 16.
});
print('pixels representing loss: ', stats.get('loss'), 'square meters')
var stats = areaImageMasked.reduceRegions({
reducer: ee.Reducer.sum(), //variously, ''sum'' or 'ee.Reducer.sum()' are used in ee documentation
collection: CAN
scale:30, //scale of image pixel size should always be specified, as per guides/reducers_reduce_region
//tileScale:16 //valid tileScale is 1 to 16.
});
print('pixels representing loss: ', stats.get('loss'), 'square meters')
var ecoregions = ee.FeatureCollection("RESOLVE/ECOREGIONS/2017")
var singleRegion=ecoregions.filter(ee.Filter.eq('ECO_NAME','East Siberian taiga'))
var stats = areaImageMasked.reduceRegion({
reducer: ee.Reducer.sum(),
geometry: singleRegion,
scale:30,
maxPixels:1e12 //There appear to be 9176816981 to count!!
});
var ecoregions = ee.FeatureCollection("RESOLVE/ECOREGIONS/2017")
var singleRegion=ecoregions.filter(ee.Filter.eq('ECO_NAME','East Siberian taiga'))
var stats = areaImageMasked.reduceRegion({
reducer: ee.Reducer.sum(),
geometry: singleRegion,
scale:30,
maxPixels:1e12 //There appear to be 9176816981 to count!!
});