我需要创建一个国家/地区的森林损失除以国家/地区大小(面积)的图表。为此,我正在使用GoogleEarthEngine。我绝对不知道该怎么做。
我有以下代码来创建每个国家/地区的森林总损失图表,但是我不知道如何将其除以国家/地区大小。
print(HansenForest);
var lossImage = HansenForest.select(['loss']);
// Add the loss layer in red.
Map.addLayer(lossImage.updateMask(lossImage),
{palette: ['FF0000']}, 'Loss');
// Load country boundaries from a Fusion Table.
var countries =
ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');
// Layout of the chart
var title = {
title: 'Loss per Country',
hAxis: {title: 'Country'},
vAxis: {title: 'Loss'}}
// Insert Chart
var chart = ui.Chart.image.byRegion({
image: HansenForest.select(['loss']),
regions: countries,
reducer: ee.Reducer.sum(),
scale: 1000,
// Scale is increased to lower the computational requirements of the analysis.
xProperty: 'Country'
})
.setChartType('ColumnChart')
.setOptions(title);
print(chart);