{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "2", "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "id": "3", "metadata": {}, "source": [ "## Create an interactive map \n", "The default basemap is `Google Maps`. Additional basemaps can be added using the `Map.add_basemap()` function." ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map(center=[40, -100], zoom=4)\n", "Map.add_basemap(\"HYBRID\") # Add Google Satellite\n", "Map" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Add Earth Engine Python script" ] }, { "cell_type": "code", "execution_count": null, "id": "6", "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\": [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"],\n", "}\n", "\n", "# Print the elevation of Mount Everest.\n", "xy = ee.Geometry.Point([86.9250, 27.9881])\n", "elev = image.sample(xy, 30).first().get(\"elevation\").getInfo()\n", "print(\"Mount Everest elevation (m):\", elev)\n", "\n", "# Add Earth Engine layers to Map\n", "Map.addLayer(image, vis_params, \"DEM\")\n", "Map.addLayer(xy, {\"color\": \"red\"}, \"Mount Everest\")\n", "\n", "# Center the map based on an Earth Engine object or coordinates (longitude, latitude)\n", "# Map.centerObject(xy, 4)\n", "Map.setCenter(86.9250, 27.9881, 4)" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "## Display Earth Engine data layers" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "Map.addLayerControl() # This line is not needed for ipyleaflet-based Map.\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }