Add clip with several overlays method

This commit is contained in:
Alireza Adli 2024-03-28 19:27:28 -04:00
parent 04c10dacfb
commit 35d58c67f0

View File

@ -79,9 +79,40 @@ class ScrubMTL:
f'{geo_index_clipped.layer.featureCount()}')
def process_property_assesment(self):
print(f'Data Count of the GeoIndex layer: {self.property_assessment.data_count}')
print(f'Data Count of the GeoIndex layer: '
f'{self.property_assessment.data_count}')
self.property_assessment.create_spatial_index()
def clip_with_several_overlays(self, input_layer_path, input_layer_name,
overlaying_layer_path, overlaying_layer_name,
number_of_overlays, splitted_layers_dir,
clipped_layers_dir):
"""This method clips using desired number of overlay layers
by splitting a big overlaying layer. It uses the ScrubLayer class
clip_layer method."""
overlaying_layer = \
self.initialize_layer(overlaying_layer_path, overlaying_layer_name)
input_layer = \
self.initialize_layer(input_layer_path, input_layer_name)
overlaying_layer.\
split_layer(number_of_overlays, splitted_layers_dir, self.qgis_path)
create_folders(clipped_layers_dir, number_of_overlays)
for overlay_layer_num in range(number_of_overlays):
splitted_overlay_layer_path = \
splitted_layers_dir + \
f'/layer_{overlay_layer_num}/layer_{overlay_layer_num}.shp'
clipped_layer_partition_path = \
clipped_layers_dir + \
f'/layer_{overlay_layer_num}/layer_{overlay_layer_num}.shp'
input_layer.clip_layer(splitted_overlay_layer_path,
clipped_layer_partition_path)
clipped_layer = \
self.initialize_layer(clipped_layer_partition_path,
f'clipped_layer_{overlay_layer_num}')
clipped_layer.create_spatial_index()
print('Pairwise Clipping is completed.')
def refine_heights(self):
pass