{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder)\n", "\n", "**Using local raster datasets or remote Cloud Optimized GeoTIFFs (COG) with geemap**\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) and [localtileserver](https://github.com/banesullivan/localtileserver) if needed." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# !pip install geemap localtileserver" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Specify input raster datasets" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out_dir = os.path.expanduser('~/Downloads')\n", "\n", "if not os.path.exists(out_dir):\n", " os.makedirs(out_dir)\n", "\n", "dem = os.path.join(out_dir, 'dem.tif')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download samples raster datasets." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "if not os.path.exists(dem):\n", " dem_url = 'https://drive.google.com/file/d/1vRkAWQYsLWCi6vcTMk8vLxoXMFbdMFn8/view?usp=sharing'\n", " geemap.download_file(dem_url, dem, unzip=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create an interactive map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add local raster datasets to the map. The available palettes can be found at https://jiffyclub.github.io/palettable/" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.add_local_tile(dem, palette='terrain', layer_name=\"DEM\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Add a remote Cloud Optimized GeoTIFF(COG) to the map." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m.add_remote_tile(url, layer_name=\"CA Fire\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }