公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
Forest Monitoring for Action (FORMA) 数据简介
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
FORMA 是一种基于 MODIS 的森林砍伐预警系统,可每半个月提供一次热带雨林森林砍伐预警,预警范围为 500 x 500 米。Earth Engine 中的 FORMA 500 数据集是一张包含自 2006 年 1 月起每月更新的提醒的图片。每个提醒都具有一个关联的时间,该时间以 epoch 秒为单位,位于名为 alert_date
的单个频段中。按日期过滤 FORMA 数据并计算感兴趣区域内的提醒是您可以使用 FORMA 数据集完成的两项最重要的任务。
如需仅显示 2012 年发生的提醒,请查找时间介于 2012 年第一天和 2013 年第一天之间的像素(以自 1970 年 1 月 1 日午夜以来的秒数表示):
代码编辑器 (JavaScript)
// Convert dates from milliseconds to seconds.
var start = ee.Date('2012-01-01').millis().divide(1000);
var end = ee.Date('2013-01-01').millis().divide(1000);
// Load the FORMA 500 dataset.
var forma = ee.Image('FORMA/FORMA_500m');
// Create a binary layer from the dates of interest.
var forma2012 = forma.gte(start).and(forma.lte(end));
Map.setCenter(15.87, -0.391, 7);
Map.addLayer(
forma2012.mask(forma2012),
{palette: ['FF0000']},
'FORMA alerts in 2012'
);
在此示例中,forma2012
是一个二元图像,仅包含时间发生在 2012 年的像素(即所有其他像素都被遮盖)。
与上一部分中处理 Hansen 等人的数据一样,我们可以先统计感兴趣区域内的 FORMA 提醒(像素)数量。例如,如需统计 2012 年刚果共和国保护区内的警报数量,请在上述示例的基础上进行如下修改:
代码编辑器 (JavaScript)
// Load country features from Large Scale International Boundary (LSIB) dataset.
var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
// Subset the Congo Republic feature from countries.
var congo = ee.Feature(
countries
.filter(ee.Filter.eq('country_na', 'Rep of the Congo'))
.first()
);
// Subset protected areas to the bounds of the congo feature
// and other criteria. Clip to the intersection with congo.
var protectedAreas = ee.FeatureCollection('WCMC/WDPA/current/polygons')
.filter(ee.Filter.and(
ee.Filter.bounds(congo.geometry()),
ee.Filter.neq('IUCN_CAT', 'VI'),
ee.Filter.neq('STATUS', 'proposed'),
ee.Filter.lt('STATUS_YR', 2010)
))
.map(function(feat){
return congo.intersection(feat);
});
// Display protected areas on the map.
Map.addLayer(
protectedAreas,
{color: '000000'},
'Congo Republic protected areas'
);
// Calculate the number of FORMA pixels in protected
// areas of the Congo Republic, 2012.
var stats = forma2012.reduceRegion({
reducer: ee.Reducer.sum(),
geometry: protectedAreas.geometry(),
scale: 500
});
print('Number of FORMA pixels, 2012: ', stats.get('constant'));
到目前为止,我们一直是在单个区域中一次性计算统计信息。如需同时计算多个地区的统计信息,您可以使用 reduceRegions()
。我们再次基于上一个示例进行构建:
代码编辑器 (JavaScript)
var regionsStats = forma2012.reduceRegions({
collection: protectedAreas,
reducer: ee.Reducer.sum(),
scale: forma2012.projection().nominalScale()
});
print(regionsStats);
检查输出到控制台的对象,并观察到 reduceRegions()
的输出是另一个 FeatureCollection
。请注意,刚果共和国保护区集合中的每个区域现在都有一个额外的属性 sum
,该属性以精简器的名称命名。此属性的值是 reducer 的输出,即保护区内 2012 年的警报数量。
如需比较 FORMA 和 Hansen 等人的数据集,您可以使用逻辑运算符。
(详细了解逻辑运算)。具体来说,我们希望制作一张图片,其中被 FORMA 和 Hansen 等人的数据标记为森林砍伐的像素值为 1,其余像素值为 0。此代码会生成 2012 年的此类图片,并将其与其他预测的森林砍伐层一起显示:
代码编辑器 (JavaScript)
// Convert dates from milliseconds to seconds.
var start = ee.Date('2012-01-01').millis().divide(1000);
var end = ee.Date('2013-01-01').millis().divide(1000);
var region = ee.Geometry.Rectangle([-59.81163, -9.43348, -59.27561, -9.22818]);
// Load the FORMA 500 dataset.
var forma = ee.Image('FORMA/FORMA_500m');
// Create a binary layer from the dates of interest.
var forma2012 = forma.gte(start).and(forma.lte(end));
// Load Hansen et al. data and get change in 2012.
var gfc = ee.Image('UMD/hansen/global_forest_change_2015');
var gfc12 = gfc.select(['lossyear']).eq(12);
// Create an image which is one where the datasets
// both show deforestation and zero elsewhere.
var gfc_forma = gfc12.eq(1).and(forma2012.eq(1));
// Display data on the map.
Map.setCenter(-59.58813, -9.36439, 11);
Map.addLayer(forma.updateMask(forma), {palette: '00FF00'}, 'Forma (green)');
Map.addLayer(gfc12.updateMask(gfc12), {palette: 'FF0000'}, 'Hansen (red)');
Map.addLayer(
gfc_forma.updateMask(gfc_forma),
{palette: 'FFFF00'},
'Hansen & FORMA (yellow)'
);
Earth Engine 中森林变化数据集的概览到此结束。我们期待看到您能用它们做出什么!
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eFORMA is a deforestation alerting system for humid tropical forests based on MODIS data, providing alerts with a corresponding time in epoch seconds.\u003c/p\u003e\n"],["\u003cp\u003eUsers can filter FORMA alerts by date, enabling analysis of deforestation events within specific timeframes.\u003c/p\u003e\n"],["\u003cp\u003eThe number of FORMA alerts within a region of interest or multiple regions can be calculated, facilitating quantitative assessment of deforestation.\u003c/p\u003e\n"],["\u003cp\u003eFORMA data can be compared with other datasets like Hansen et al.to identify areas where both indicate deforestation, offering a comprehensive analysis.\u003c/p\u003e\n"]]],[],null,["# Introduction to Forest Monitoring for Action (FORMA) data\n\nFORMA is a [MODIS](http://modis.gsfc.nasa.gov/about/) based 500 x 500\nmeter twice-monthly deforestation alerting system for the humid tropical forests. The\n[FORMA 500 dataset](/earth-engine/datasets/catalog/FORMA_FORMA_500m) in Earth\nEngine is an image with alerts starting in January 2006 and updated monthly. Each alert has a\ntime associated with it in a single band named `alert_date` in units of\n[epoch seconds](https://en.wikipedia.org/wiki/Unix_time). Filtering FORMA by dates\nand calculating alerts within areas of interest are two of the most important things you can\ndo with the FORMA dataset.\n\nFiltering FORMA by Date\n-----------------------\n\nTo show just those alerts that occur in 2012, find pixels that have times between the\nfirst day of 2012 and the first day of 2013, expressed in seconds since midnight,\nJanuary 1, 1970:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Convert dates from milliseconds to seconds.\nvar start = ee.Date('2012-01-01').millis().divide(1000);\nvar end = ee.Date('2013-01-01').millis().divide(1000);\n\n// Load the FORMA 500 dataset.\nvar forma = ee.Image('FORMA/FORMA_500m');\n\n// Create a binary layer from the dates of interest.\nvar forma2012 = forma.gte(start).and(forma.lte(end));\n\nMap.setCenter(15.87, -0.391, 7);\nMap.addLayer(\n forma2012.mask(forma2012),\n {palette: ['FF0000']},\n 'FORMA alerts in 2012'\n);\n```\n\nIn this example, `forma2012` is a binary image containing only those pixels\nthat have times occurring in 2012 (i.e. all other pixels are masked).\n\nCounting FORMA Alerts in a Region of Interest\n---------------------------------------------\n\n[As we did\nin the previous section](/earth-engine/tutorials/tutorial_forest_03#quantifying-forest-change-in-an-area-of-interest) with the Hansen et al. data, we can start by counting the\nnumber of FORMA alerts (pixels) in an area of interest. For example, to count the number\nof alerts in protected areas of the Congo Republic in 2012, build on the previous example as\nfollows:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load country features from Large Scale International Boundary (LSIB) dataset.\nvar countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');\n\n// Subset the Congo Republic feature from countries.\nvar congo = ee.Feature(\n countries\n .filter(ee.Filter.eq('country_na', 'Rep of the Congo'))\n .first()\n);\n\n// Subset protected areas to the bounds of the congo feature\n// and other criteria. Clip to the intersection with congo.\nvar protectedAreas = ee.FeatureCollection('WCMC/WDPA/current/polygons')\n .filter(ee.Filter.and(\n ee.Filter.bounds(congo.geometry()),\n ee.Filter.neq('IUCN_CAT', 'VI'),\n ee.Filter.neq('STATUS', 'proposed'),\n ee.Filter.lt('STATUS_YR', 2010)\n ))\n .map(function(feat){\n return congo.intersection(feat);\n });\n\n// Display protected areas on the map.\nMap.addLayer(\n protectedAreas,\n {color: '000000'},\n 'Congo Republic protected areas'\n);\n\n// Calculate the number of FORMA pixels in protected\n// areas of the Congo Republic, 2012.\nvar stats = forma2012.reduceRegion({\n reducer: ee.Reducer.sum(),\n geometry: protectedAreas.geometry(),\n scale: 500\n});\nprint('Number of FORMA pixels, 2012: ', stats.get('constant'));\n```\n\nCounting FORMA Alerts in Several Regions of Interest\n----------------------------------------------------\n\nSo far, we've been computing statistics in a single region at a time. For computing\nstatistics in multiple regions at once, you can use\n[`reduceRegions()`](/earth-engine/apidocs/ee-image-reduceregions). Again\nbuilding on the previous example:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar regionsStats = forma2012.reduceRegions({\n collection: protectedAreas,\n reducer: ee.Reducer.sum(),\n scale: forma2012.projection().nominalScale()\n});\nprint(regionsStats);\n```\n\nExamine the object printed to the console and observe that the output of\n`reduceRegions()` is another `FeatureCollection`. Note that every\nregion in the collection of the Congo Republic protected areas now has an additional property,\n`sum`, named after the reducer. The value of this property is the output of\nthe reducer, or the number of 2012 alerts in the protected areas.\n\nComparing FORMA and Hansen et al. Datasets\n------------------------------------------\n\nTo compare the FORMA and Hansen et al. datasets, you can use logical operators.\n([Learn more about logical operations](/earth-engine/guides/image_relational)). Specifically, we'd\nlike to make an image in which pixels marked by both FORMA and the Hansen et al. data\nas deforestation are 1 and the rest are zero. This code makes such an image for\n2012 and displays it along with other predicted deforestation layers:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Convert dates from milliseconds to seconds.\nvar start = ee.Date('2012-01-01').millis().divide(1000);\nvar end = ee.Date('2013-01-01').millis().divide(1000);\nvar region = ee.Geometry.Rectangle([-59.81163, -9.43348, -59.27561, -9.22818]);\n\n// Load the FORMA 500 dataset.\nvar forma = ee.Image('FORMA/FORMA_500m');\n\n// Create a binary layer from the dates of interest.\nvar forma2012 = forma.gte(start).and(forma.lte(end));\n\n// Load Hansen et al. data and get change in 2012.\nvar gfc = ee.Image('UMD/hansen/global_forest_change_2015');\nvar gfc12 = gfc.select(['lossyear']).eq(12);\n\n// Create an image which is one where the datasets\n// both show deforestation and zero elsewhere.\nvar gfc_forma = gfc12.eq(1).and(forma2012.eq(1));\n\n// Display data on the map.\nMap.setCenter(-59.58813, -9.36439, 11);\nMap.addLayer(forma.updateMask(forma), {palette: '00FF00'}, 'Forma (green)');\nMap.addLayer(gfc12.updateMask(gfc12), {palette: 'FF0000'}, 'Hansen (red)');\nMap.addLayer(\n gfc_forma.updateMask(gfc_forma),\n {palette: 'FFFF00'},\n 'Hansen & FORMA (yellow)'\n);\n```\n\nThis concludes the overview of forest change datasets in Earth Engine. We're looking\nforward to seeing what you can do with them!"]]