{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Earth Engine App" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map(center=(40, -100), zoom=4)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "24983d0778b44da6a30fcf8e83091012", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Map(bottom=1826.0, center=[40, -100], controls=(WidgetControl(options=['position'], widget=HBox(children=(Togg…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Add Earth Engine dataset\n", "dem = ee.Image('USGS/SRTMGL1_003')\n", "landcover = ee.Image(\"ESA/GLOBCOVER_L4_200901_200912_V2_3\").select('landcover')\n", "landsat7 = ee.Image('LANDSAT/LE7_TOA_5YEAR/1999_2003')\n", "states = ee.FeatureCollection(\"TIGER/2018/States\")\n", "\n", "# Set visualization parameters.\n", "vis_params = {\n", " 'min': 0,\n", " 'max': 4000,\n", " 'palette': ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5'],\n", "}\n", "\n", "# Add Earth Engine layers to Map\n", "Map.addLayer(\n", " landsat7, {'bands': ['B4', 'B3', 'B2'], 'min': 20, 'max': 200}, 'Landsat 7'\n", ")\n", "Map.addLayer(landcover, {}, 'Land cover')\n", "Map.addLayer(dem, vis_params, 'SRTM DEM', True, 1)\n", "Map.addLayer(states, {}, \"US States\")\n", "\n", "Map" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change layer opacity:\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "489beced262c43ae8e4311f5a5cd2409", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Box(children=(FloatSlider(value=1.0, description='opacity', max=1.0),))" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "print('Change layer opacity:')\n", "dem_layer = Map.layers[-2]\n", "dem_layer.interact(opacity=(0, 1, 0.1))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }