(self, root_group_name, sort_layers=False)
* Createss a group for each layer that is given by the layer source scheme
         >> mbtiles: value 'JSON' in metadata table, array 'vector_layers'
         >> TileJSON: value 'vector_layers'
        :return:
* Createss a group for each layer that is given by the layer source scheme
         >> mbtiles: value 'JSON' in metadata table, array 'vector_layers'
         >> TileJSON: value 'vector_layers'
        :return:
* Createss a group for each layer that is given by the layer source scheme >> mbtiles : value JSON in metadata table array vector_layers >> TileJSON : value vector_layers : return :
def _assure_qgis_groups_exist(self, root_group_name, sort_layers=False):
        """
         * Createss a group for each layer that is given by the layer source scheme
         >> mbtiles: value 'JSON' in metadata table, array 'vector_layers'
         >> TileJSON: value 'vector_layers'
        :return:
        """

        root = QgsProject.instance().layerTreeRoot()
        root_group = root.findGroup(root_group_name)
        if not root_group:
            root_group = root.addGroup(root_group_name)
        layers = [l["id"] for l in self._current_reader.get_source().vector_layers()]

        if sort_layers:
            layers = sorted(layers, key=lambda n: self._get_omt_layer_sort_id(n))
        for layer_name in layers:
            group = root_group.findGroup(layer_name)
            if not group:
                root_group.addGroup(layer_name)
def _assure_qgis_groups_exist ( self , root_group_name , sort_layers = False ) : root = QgsProject . instance ( ) . layerTreeRoot ( ) root_group = root . findGroup ( root_group_name ) if not root_group : root_group = root . addGroup ( root_group_name ) layers = [ l [ "id" ] for l in self . _current_reader . get_source ( ) . vector_layers ( ) ] if sort_layers : layers = sorted ( layers , key = lambda n : self . _get_omt_layer_sort_id ( n ) ) for layer_name in layers : group = root_group . findGroup ( layer_name ) if not group : root_group . addGroup ( layer_name )