Remove instantiating the laduplicated layer

This commit is contained in:
Alireza Adli 2024-08-23 16:28:48 -04:00
parent ac3c44b965
commit 6cf3581014

View File

@ -27,7 +27,7 @@ class ScrubLayer:
self.layer = self.load_layer() self.layer = self.load_layer()
self.data_count = self.layer.featureCount() self.data_count = self.layer.featureCount()
def duplicate_layer(self, output_path, duplicated_layer_name): def duplicate_layer(self, output_path):
options = QgsVectorFileWriter.SaveVectorOptions() options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = 'ESRI Shapefile' options.driverName = 'ESRI Shapefile'
@ -39,10 +39,6 @@ class ScrubLayer:
if duplication == QgsVectorFileWriter.NoError: if duplication == QgsVectorFileWriter.NoError:
print(f"Shapefile successfully duplicated") print(f"Shapefile successfully duplicated")
duplicated_layer = ScrubLayer(
self.qgis_path, output_path, duplicated_layer_name)
duplicated_layer.create_spatial_index()
return duplicated_layer
else: else:
print(f"Error duplicating shapefile: {duplication}") print(f"Error duplicating shapefile: {duplication}")