{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "**Creating a shaded relief map by blending DEM and hillshade**\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": "markdown", "metadata": {}, "source": [ "Import libraries" ] }, { "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": [ "Create an interactive map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "Map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add DEM and hillshade to the map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dem = ee.Image(\"CGIAR/SRTM90_V4\")\n", "hillsahde = ee.Terrain.hillshade(dem)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "vis = {'min': 0, 'max': 6000, 'palette': cm.palettes.dem}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map.addLayer(hillsahde, {}, 'Hillshade')\n", "Map.addLayer(dem, vis, 'DEM')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a blended image by blending DEM and hillshade" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "blend = geemap.blend(top_layer=dem, top_vis=vis)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map.addLayer(blend, {}, 'Blend')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add NLCD land cover to the map" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nlcd = ee.Image(\"USGS/NLCD_RELEASES/2019_REL/NLCD/2019\").select('landcover')\n", "nlcd_vis = {'bands': ['landcover']}\n", "Map.addLayer(nlcd, nlcd_vis, 'NLCD')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create a blended image by blending NLCD and DEM." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "result = geemap.blend(nlcd, dem, top_vis=nlcd_vis, expression='a*b')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Map.addLayer(result, {}, 'Blend NLCD')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }