{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"\n",
"\n",
"**Creating near real-time global 10-m land cover maps with geemap and Dynamic World**\n",
"\n",
"- App: \n",
"- App2: \n",
"- Paper: \n",
"- Model: \n",
"- Training data: \n",
"- Data: \n",
"- JavaScript tutorial: "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"import ee\n",
"import geemap"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"Map = geemap.Map()\n",
"Map.add_basemap(\"HYBRID\")\n",
"Map"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"# Set the region of interest by simply drawing a polygon on the map\n",
"region = Map.user_roi\n",
"if region is None:\n",
" region = ee.Geometry.BBox(-89.7088, 42.9006, -89.0647, 43.2167)\n",
"\n",
"Map.centerObject(region)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"# Set the date range\n",
"start_date = \"2021-01-01\"\n",
"end_date = \"2022-01-01\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"# Create a Sentinel-2 image composite\n",
"image = geemap.dynamic_world_s2(region, start_date, end_date)\n",
"vis_params = {\"bands\": [\"B4\", \"B3\", \"B2\"], \"min\": 0, \"max\": 3000}\n",
"Map.addLayer(image, vis_params, \"Sentinel-2 image\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"# Create Dynamic World land cover composite\n",
"landcover = geemap.dynamic_world(region, start_date, end_date, return_type=\"hillshade\")\n",
"Map.addLayer(landcover, {}, \"Land Cover\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"# Add legend to the map\n",
"Map.add_legend(title=\"Dynamic World Land Cover\", builtin_legend=\"Dynamic_World\")\n",
"Map"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"![](https://i.imgur.com/GEzsSii.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"# Save Dynamic World class data in GeoTIFF format\n",
"output_path = \"landcover.tif\"\n",
"landcover = geemap.dynamic_world(region, start_date, end_date, return_type=\"class\")\n",
"geemap.ee_export_image(\n",
" landcover, filename=output_path, scale=10, region=region, file_per_band=False\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}