{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 28 Parsing QGIS Style Files to GemGIS\n", "\n", "The following will present how to load QGIS style files (QML files) into `GemGIS`, how to set the colors for [GeoPandas](https://geopandas.org/) plots and how to automatically set the surface colors for a [GemPy](https://github.com/cgre-aachen/gempy) model. \n", "\n", "QML is an XML format for storing layer styling. A QML file contains all the information QGIS can handle for the rendering of feature geometries including symbol definitions, sizes and rotations, labelling, opacity and blend mode and more.\n", "\n", "\n", "\n", "Sources: https://docs.qgis.org/3.4/en/docs/user_manual/appendices/qgis_file_formats.html#qml-the-qgis-style-file-format" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Set File Paths and download Tutorial Data\n", "\n", "If you downloaded the latest `GemGIS` version from the Github repository, append the path so that the package can be imported successfully. Otherwise, it is recommended to install `GemGIS` via `pip install gemgis` and import `GemGIS` using `import gemgis as gg`. In addition, the file path to the folder where the data is being stored is set. The tutorial data is downloaded using Pooch (https://www.fatiando.org/pooch/latest/index.html) and stored in the specified folder. Use `pip install pooch` if Pooch is not installed on your system yet." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2021-03-17T11:24:00.292523Z", "start_time": "2021-03-17T11:23:58.137423Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`\n", "C:\\Users\\ale93371\\Anaconda3\\envs\\test_gempy\\lib\\site-packages\\theano\\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory\n", " warnings.warn(\"DeprecationWarning: there is no c++ compiler.\"\n", "WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.\n", "WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.\n" ] } ], "source": [ "import gemgis as gg\n", "file_path ='data/28_parsing_QGIS_style_files/'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-03-17T11:24:00.588008Z", "start_time": "2021-03-17T11:24:00.324315Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Downloading file '28_parsing_QGIS_style_files.zip' from 'https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F28_parsing_QGIS_style_files.zip' to 'C:\\Users\\ale93371\\Documents\\gemgis\\docs\\getting_started\\tutorial\\data\\28_parsing_QGIS_style_files'.\n" ] } ], "source": [ "gg.download_gemgis_data.download_tutorial_data(filename=\"28_parsing_QGIS_style_files.zip\", dirpath=file_path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load Files\n", "\n", "A shape file containing Polygons is loaded for demonstration." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2021-01-03T09:07:26.591726Z", "start_time": "2021-01-03T09:07:23.719677Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`\n", "C:\\Users\\ale93371\\Anaconda3\\envs\\test_gempy\\lib\\site-packages\\theano\\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory\n", " warnings.warn(\"DeprecationWarning: there is no c++ compiler.\"\n", "WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.\n", "WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.\n" ] }, { "data": { "text/html": [ "
\n", " | id | \n", "formation | \n", "geometry | \n", "
---|---|---|---|
0 | \n", "None | \n", "Sand1 | \n", "POLYGON ((0.256 264.862, 10.593 276.734, 17.13... | \n", "
1 | \n", "None | \n", "Ton | \n", "POLYGON ((0.256 264.862, 0.188 495.787, 8.841 ... | \n", "
2 | \n", "None | \n", "Sand2 | \n", "POLYGON ((0.188 495.787, 0.249 1068.760, 278.5... | \n", "
3 | \n", "None | \n", "Sand2 | \n", "POLYGON ((511.675 1068.852, 971.698 1068.800, ... | \n", "