{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"Open\n", "\n", "Uncomment the following line to install [geemap](https://geemap.org) if needed." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# !pip install geemap" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "import geemap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a QGIS Layer Style File for NLCD data\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "out_nlcd_qml = os.path.join(os.path.expanduser('~/Downloads'), 'nlcd_style.qml')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "geemap.create_nlcd_qml(out_nlcd_qml)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Create a QGIS Layer Style File from an Earth Engine color table\n", "\n", "Separated by Tab" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "ee_class_table = \"\"\"\n", "\n", " Value\tColor\tDescription\n", " 0\t1c0dff\tWater\n", " 1\t05450a\tEvergreen needleleaf forest\n", " 2\t086a10\tEvergreen broadleaf forest\n", " 3\t54a708\tDeciduous needleleaf forest\n", " 4\t78d203\tDeciduous broadleaf forest\n", " 5\t009900\tMixed forest\n", " 6\tc6b044\tClosed shrublands\n", " 7\tdcd159\tOpen shrublands\n", " 8\tdade48\tWoody savannas\n", " 9\tfbff13\tSavannas\n", " 10\tb6ff05\tGrasslands\n", " 11\t27ff87\tPermanent wetlands\n", " 12\tc24f44\tCroplands\n", " 13\ta5a5a5\tUrban and built-up\n", " 14\tff6d4c\tCropland/natural vegetation mosaic\n", " 15\t69fff8\tSnow and ice\n", " 16\tf9ffa4\tBarren or sparsely vegetated\n", " 254\tffffff\tUnclassified\n", "\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "out_qml = os.path.join(os.path.expanduser('~/Downloads'), 'image_style.qml')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "geemap.vis_to_qml(ee_class_table, out_qml)" ] } ], "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 } }, "nbformat": 4, "nbformat_minor": 4 }