Add load_layer to the basic functions

This commit is contained in:
Alireza Adli 2024-05-19 13:02:31 -04:00
parent ce515b5427
commit c97ff67ca4

View File

@ -2,6 +2,16 @@ import os
import glob
import time
from qgis.core import QgsProject, QgsVectorLayer
def load_layer(path, layer_name):
the_layer = QgsVectorLayer(path, layer_name, 'ogr')
if not the_layer.isValid():
print(f'{layer_name} failed to load!')
else:
QgsProject.instance().addMapLayer(the_layer)
return the_layer, layer_name
def create_folders(directory, num_folders):
"""