113 image area
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !pip install geemap
In [ ]:
Copied!
import ee
import geemap
import ee
import geemap
Add ESA Land Cover data.
In [ ]:
Copied!
Map = geemap.Map()
dataset = ee.ImageCollection("ESA/WorldCover/v100").first()
Map.addLayer(dataset, {"bands": ["Map"]}, "ESA Land Cover")
Map.add_legend(builtin_legend="ESA_WorldCover")
Map
Map = geemap.Map()
dataset = ee.ImageCollection("ESA/WorldCover/v100").first()
Map.addLayer(dataset, {"bands": ["Map"]}, "ESA Land Cover")
Map.add_legend(builtin_legend="ESA_WorldCover")
Map
Calculate the area of each land cover type.
In [ ]:
Copied!
df = geemap.image_area_by_group(
dataset, scale=1000, denominator=1e6, decimal_places=4, verbose=True
)
df
df = geemap.image_area_by_group(
dataset, scale=1000, denominator=1e6, decimal_places=4, verbose=True
)
df
Save the results to a CSV.
In [ ]:
Copied!
df.to_csv("esa_area.csv")
df.to_csv("esa_area.csv")
Add NLCD land cover data.
In [ ]:
Copied!
Map = geemap.Map(center=[40, -100], zoom=4)
Map.add_basemap("HYBRID")
nlcd = ee.Image("USGS/NLCD_RELEASES/2019_REL/NLCD/2019")
landcover = nlcd.select("landcover")
Map.addLayer(landcover, {}, "NLCD Land Cover 2019")
Map.add_legend(
title="NLCD Land Cover Classification", builtin_legend="NLCD", height="465px"
)
Map
Map = geemap.Map(center=[40, -100], zoom=4)
Map.add_basemap("HYBRID")
nlcd = ee.Image("USGS/NLCD_RELEASES/2019_REL/NLCD/2019")
landcover = nlcd.select("landcover")
Map.addLayer(landcover, {}, "NLCD Land Cover 2019")
Map.add_legend(
title="NLCD Land Cover Classification", builtin_legend="NLCD", height="465px"
)
Map
Calculate the area of each land cover type.
In [ ]:
Copied!
df = geemap.image_area_by_group(
landcover, scale=1000, denominator=1e6, decimal_places=4, verbose=True
)
df
df = geemap.image_area_by_group(
landcover, scale=1000, denominator=1e6, decimal_places=4, verbose=True
)
df
Save the results to a CSV.
In [ ]:
Copied!
df.to_csv("nlcd_area.csv")
df.to_csv("nlcd_area.csv")