{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Explore Mangrove Dataset" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Uncomment and run the following cell only once to install the required dependencies" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !pip install -r ../requirements.txt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap.eefolium as geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Open a terminal and authorize access to your Earth Engine account by running\n", "\n", "```\n", "pip install earthengine-api\n", "earthengine authenticate\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Initialize Earth Engine so that we can retrive dataset from the catalog\n", "ee.Initialize()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Retrive dataset as a collection of images from Earth Engine Catalog\n", "mangrove_images_landsat = ee.ImageCollection('LANDSAT/MANGROVE_FORESTS')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Retrive dataset as a collection of images from Earth Engine Catalog\n", "mangrove_images_landsat = ee.ImageCollection('LANDSAT/MANGROVE_FORESTS')\n", "\n", "# Grab the first image from the collection (there's only one in the collection)\n", "mangrove_images_landsat = mangrove_images_landsat.first()\n", "\n", "# Specify visualization parameters\n", "mangrovesVis = {\n", " min: 0,\n", " max: 1.0,\n", " 'palette': ['d40115'],\n", " }\n", "\n", "# Instantiate a map\n", "mangrove_map = geemap.Map() \n", "\n", "# Add mangrove dataset as a leyer to the interactive map using the visualization parameters\n", "mangrove_map.addLayer(mangrove_images_landsat, mangrovesVis, 'Mangroves')\n", "\n", "# Center the map using longitude, latitude, zoom level\n", "mangrove_map.setCenter(-81, 25, 9)\n", "\n", "# Display the map\n", "mangrove_map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Get useful information about the dataset\n", "\n", "geemap.image_props(mangrove_images_landsat).getInfo()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Pixel size in meters in the image dataset (same info as \"NOMINAL_SCALE\" above)\n", "\n", "geemap.image_cell_size(mangrove_images_landsat).getInfo()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "instance_type": "ml.t3.medium", "kernelspec": { "display_name": "Python 3 (Data Science)", "language": "python", "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-2:429704687514:image/datascience-1.0" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }