{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "## Using geemap with Google Colab\n", "\n", "### Instructions\n", "\n", "To use geemap and the Earth Engine Python API, you must [register](https://code.earthengine.google.com/register) for an Earth Engine account and follow the instructions [here](https://docs.google.com/document/d/1ZGSmrNm6_baqd8CHt33kIBWOlvkh-HLr46bODgJN1h0/edit?usp=sharing) to create a Cloud Project. Earth Engine is free for [noncommercial and research use](https://earthengine.google.com/noncommercial)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Install geemap" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%pip install geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import libraries" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Create an interactive map\n", "\n", "Running the following cell will start the Earth Engine authentication. Follow the instructions [here](https://book.geemap.org/chapters/01_introduction.html#earth-engine-authentication) to authenticate Earth Engine." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Add Earth Engine data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Add Earth Engine dataset\n", "image = ee.Image('USGS/SRTMGL1_003')\n", "\n", "# Set visualization parameters.\n", "vis_params = {\n", " 'min': 0,\n", " 'max': 4000,\n", " 'palette': 'terrain',\n", "}\n", "\n", "# Add Earth Engine layers to Map\n", "Map.addLayer(image, vis_params, 'DEM')\n", "\n", "# Center the map based on an Earth Engine object or coordinates (longitude, latitude)\n", "Map.setCenter(86.9250, 27.9881, 4)\n", "Map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you can see the map above, you have successfully authenticated the Earth Engine Python API. Otherwise, you might need to follow the instructions [here](https://docs.google.com/document/d/1ZGSmrNm6_baqd8CHt33kIBWOlvkh-HLr46bODgJN1h0/edit?usp=sharing) to create a Cloud Project, which is required to use the Earth Engine Python API." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }