# Example usage:
#
# from gee_polygons.datasets.mapbiomas import MAPBIOMAS_DEFREG
# from gee_polygons.site import load_sites
#
# sites = load_sites('restoration_sites.geojson')
# site = sites[0]
#
# # Extract deforestation/regeneration stats
# df = site.extract_categorical(MAPBIOMAS_DEFREG, years=range(2018, 2025))
# print(df.head())datasets.mapbiomas
MapBiomas presets: class definitions, palettes, and layer configurations for Brazilian land cover data.
About MapBiomas
MapBiomas is a collaborative network that produces annual land cover and land use maps for Brazil (and other countries) using Landsat imagery and machine learning.
This module provides pre-configured CategoricalLayer objects for common MapBiomas products, so you can extract statistics without manually specifying asset paths and class definitions.
Deforestation & Secondary Vegetation
The deforestation/regeneration product tracks: - Primary vs. secondary vegetation - Deforestation events - Regrowth/regeneration
Land Use / Land Cover (LULC)
The main LULC product with detailed land cover classes.
Usage
These presets make extraction simple:
# Check the layer configuration
print(MAPBIOMAS_DEFREG)
print(f"\nClass 3: {MAPBIOMAS_DEFREG.class_name(3)} ({MAPBIOMAS_DEFREG.class_color(3)})")
print(f"Class 5: {MAPBIOMAS_DEFREG.class_name(5)} ({MAPBIOMAS_DEFREG.class_color(5)})")CategoricalLayer(asset_id='projects/mapbiomas-public/assets/brazil/lulc/collection10/mapbiomas_brazil_collection10_deforestation_secondary_vegetation_v2', band_pattern='classification_{}', scale=30, class_map={0: 'Other', 1: 'Anthropic', 2: 'Primary Vegetation', 3: 'Secondary Vegetation', 4: 'Deforestation in Primary Veg', 5: 'Secondary Veg Regrowth', 6: 'Deforestation in Secondary Veg', 7: 'Not Applied'}, palette={0: '#212121', 1: '#cdc98d', 2: '#09611f', 3: '#4ea376', 4: '#e31a1c', 5: '#94fc03', 6: '#ffa500', 7: '#212121'})
Class 3: Secondary Vegetation (#4ea376)
Class 5: Secondary Veg Regrowth (#94fc03)