{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap\n", "import geemap.cartoee as cartoee\n", "import geemap.colormaps as cmp\n", "\n", "%pylab inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "geemap.ee_initialize()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# get an image\n", "srtm = ee.Image(\"CGIAR/SRTM90_V4\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "palette = cmp.palettes.dem" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "region = [70, 15, 140, 60] # define bounding box to request data\n", "vis = {'min': 0, 'max': 5000} # define visualization parameters for image\n", "vis = {'palette': palette, 'min': 0.0, 'max': 6000.0, 'opacity': 1.0}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fig = plt.figure(figsize=(15, 10))\n", "\n", "# use cartoee to get a map\n", "ax = cartoee.get_map(srtm, region=region, vis_params=vis)\n", "\n", "# add a colorbar to the map using the visualization params we passed to the map\n", "cartoee.add_colorbar(\n", " ax,\n", " vis,\n", " loc=\"bottom\",\n", " label=\"Elevation\",\n", " orientation=\"horizontal\",\n", " posOpts=[0.25, 0.05, 0.5, 0.02],\n", ")\n", "\n", "# add gridlines to the map at a specified interval\n", "cartoee.add_gridlines(ax, interval=[10, 10], linestyle=\":\")\n", "\n", "# add coastlines using the cartopy api\n", "ax.coastlines(color=\"red\")\n", "\n", "show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](https://i.imgur.com/MfTVP8X.png)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }