{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap\n", "import geemap.colormaps as cm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If run into errors, uncomment the following line to update the package and restart the kernel to take effect." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# geemap.update_package()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "Map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Draw a rectangle/polygon on the map to be used as an Area of Interest (AOI). If no AOI is specified, the entire image collection will be used." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "region = Map.user_roi" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use any Earth Engine collection to filter data, for example, using Landsat 8 Collection 2." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "collection = ee.ImageCollection(\"LANDSAT/LC08/C02/T1_L2\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can filter the image collection by region and date range. Set `clip=True` if you want to clip the resulting image to the region boundary." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "image = geemap.image_count(\n", " collection, region, start_date='2021-01-01', end_date='2022-01-01', clip=False\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set visualization parameters." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "vis = {'min': 0, 'max': 60, 'palette': cm.palettes.coolwarm}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map.addLayer(image, vis, 'Landsat 8 Image Count')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add country boundaries to the map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "countries = ee.FeatureCollection('users/giswqs/public/countries')\n", "style = {\"color\": \"00000088\", \"width\": 1, \"fillColor\": \"00000000\"}\n", "Map.addLayer(countries.style(**style), {}, \"Countries\")\n", "Map.add_colorbar(vis, label='Landsat 8 Image Count')\n", "Map" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }