{ "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", "%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(ax, vis, loc=\"bottom\", label=\"Elevation\", orientation=\"horizontal\", posOpts=[0.25, 0.05, 0.5, 0.02])\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": { "hide_input": false, "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.5" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }