gemgis.utils.load_surface_colors#

gemgis.utils.load_surface_colors(path: str, gdf: geopandas.geodataframe.GeoDataFrame) List[str]#

Loading surface colors from a QML file and storing the color values as list to be displayed with GeoPandas plots

Parameters
  • path (str) – Path to the qml file, e.g. qml_name='style.qml'

  • gdf (gpd.geodataframe.GeoDataFrame) – GeoDataFrame of which objects are supposed to be plotted, usually loaded from a polygon/line shape file

Returns

cols – List of color values for each surface

Return type

List[str]

New in version 1.0.x.

Example

>>> # Loading Libraries and File
>>> import gemgis as gg
>>> import geopandas as gpd
>>> gdf = gpd.read_file(filename='file.shp')
>>> # Loading surface colors
>>> colors = gg.utils.load_surface_colors(path='style.qml', gdf=gdf)
>>> colors
['#b35a2a', '#b35a2a', '#525252']

See also

build_style_dict

Building style dictionairy from loaded style file

parse_categorized_qml

Reading the contents of a QGIS Style file (qml)

create_surface_color_dict

Creating dict with colors for each formation