(existing_styles, style_dir, layer, geo_type)
Looks for a styles with the same name as the layer and if one is found, it is applied to the layer
        :param layer: The layer to which the style shall be applied
        :param geo_type: The geo type of the features on the layer (point, linestring or polygon)
        :return:
Looks for a styles with the same name as the layer and if one is found, it is applied to the layer
        :param layer: The layer to which the style shall be applied
        :param geo_type: The geo type of the features on the layer (point, linestring or polygon)
        :return:
Looks for a styles with the same name as the layer and if one is found it is applied to the layer : param layer : The layer to which the style shall be applied : param geo_type : The geo type of the features on the layer ( point linestring or polygon ) : return :
def _apply_named_style(existing_styles, style_dir, layer, geo_type):
        """
        Looks for a styles with the same name as the layer and if one is found, it is applied to the layer
        :param layer: The layer to which the style shall be applied
        :param geo_type: The geo type of the features on the layer (point, linestring or polygon)
        :return: 
        """
        try:
            name = layer.name().lower()
            styles = [
                "{}.{}".format(name, geo_type.lower()),
                name,
                "transparent.{}".format(geo_type.lower()),
                geo_type.lower(),
            ]
            for p in styles:
                style_name = "{}.qml".format(p).lower()
                if style_name in existing_styles:
                    style_path = os.path.join(style_dir, style_name)
                    res = layer.loadNamedStyle(style_path)
                    if res[1]:  # Style loaded
                        layer.setCustomProperty("VectorTilesReader/layerStyle", style_path)
                        break
        except:
            critical("Loading style failed: {}", sys.exc_info())
def _apply_named_style ( existing_styles , style_dir , layer , geo_type ) : try : name = layer . name ( ) . lower ( ) styles = [ "{}.{}" . format ( name , geo_type . lower ( ) ) , name , "transparent.{}" . format ( geo_type . lower ( ) ) , geo_type . lower ( ) , ] for p in styles : style_name = "{}.qml" . format ( p ) . lower ( ) if style_name in existing_styles : style_path = os . path . join ( style_dir , style_name ) res = layer . loadNamedStyle ( style_path ) if res [ 1 ] : # Style loaded layer . setCustomProperty ( "VectorTilesReader/layerStyle" , style_path ) break except : critical ( "Loading style failed: {}" , sys . exc_info ( ) )