gemgis.utils.build_style_dict#

gemgis.utils.build_style_dict(classes: dict) dict#

Building a style dict based on extracted style classes

Parameters

classes (dict) – Dict containing the styles of objects

Returns

styles – Dict containing styles for different objects

Return type

dict

New in version 1.0.x.

Example

>>> # Loading Libraries and File
>>> import gemgis as gg
>>> column, classes = gg.utils.parse_categorized_qml(qml_name='style.qml')
>>>column
'formation'
>>> # Inspecting classes
>>> classes
{'Sand1': {'border_width_map_unit_scale': '3x:0,0,0,0,0,0',
'color': '179,90,42,255',
'joinstyle': 'bevel',
'offset': '0,0',
'offset_map_unit_scale': '3x:0,0,0,0,0,0',
'offset_unit': 'MM',
'outline_color': '102,51,24,255',
'outline_style': 'solid',
'outline_width': '0.26',
'outline_width_unit': 'MM',
'style': 'solid'},....}
>>> # Creating Style Dict
>>> style_dict = gg.utils.build_style_dict(classes=classes)
>>> style_dict
{'Sand1': {'color': '#b35a2a',
'color_rgb': [179, 90, 42],
'opacity': 1.0,
'weight': 0.26,
'fillColor': '#b35a2a',
'fillOpacity': 1.0},...}

See also

parse_categorized_qml

Reading the contents of a QGIS Style file (qml)

load_surface_colors

Loading surface colors as list

create_surface_color_dict

Creating dict with colors for each formation