Add processing Property Assessment method

This commit is contained in:
Alireza Adli 2024-03-28 18:34:42 -04:00
parent f91764184d
commit 04c10dacfb

View File

@ -3,12 +3,13 @@ from basic_functions import *
class ScrubMTL: class ScrubMTL:
def __init__(self, qgis_path, nrcan, geoindex, property_assessment, def __init__(self, qgis_path, nrcan, geo_index, property_assessment,
montreal_boundary, output_paths_dir): montreal_boundary, output_paths_dir):
self.qgis_path = qgis_path self.qgis_path = qgis_path
self.nrcan = nrcan self.nrcan = self.initialize_layer(nrcan, 'NRCan')
self.geoindex = geoindex self.geo_index = self.initialize_layer(geo_index, 'GeoIndex')
self.property_assessment = property_assessment self.property_assessment = \
self.initialize_layer(property_assessment, 'Property Assessment')
self.montreal_boundary = montreal_boundary self.montreal_boundary = montreal_boundary
self.output_paths_dir = output_paths_dir self.output_paths_dir = output_paths_dir
self.output_paths = { self.output_paths = {
@ -46,10 +47,9 @@ class ScrubMTL:
return ScrubLayer(self.qgis_path, layer_path, layer_name) return ScrubLayer(self.qgis_path, layer_path, layer_name)
def process_nrcan(self): def process_nrcan(self):
nrcan = self.initialize_layer(self.nrcan, 'NRCan') print(f'Data Count of the NRCan layer: {self.nrcan.data_count}')
print(f'Data Count of the NRCan layer: {nrcan.data_count}') self.nrcan.create_spatial_index()
nrcan.create_spatial_index() self.nrcan.fix_geometries(self.output_paths['Fixed NRCan'])
nrcan.fix_geometries(self.output_paths['Fixed NRCan'])
nrcan_fixed = \ nrcan_fixed = \
self.initialize_layer(self.output_paths['Fixed NRCan'], self.initialize_layer(self.output_paths['Fixed NRCan'],
'Fixed NRCan') 'Fixed NRCan')
@ -58,10 +58,9 @@ class ScrubMTL:
f'after fixing geometries: {nrcan_fixed.layer.featureCount()}') f'after fixing geometries: {nrcan_fixed.layer.featureCount()}')
def process_geo_index(self): def process_geo_index(self):
geo_index = self.initialize_layer(self.geoindex, 'GeoIndex') print(f'Data Count of the GeoIndex layer: {self.geo_index.data_count}')
print(f'Data Count of the GeoIndex layer: {geo_index.data_count}') self.geo_index.create_spatial_index()
geo_index.create_spatial_index() self.geo_index.fix_geometries(self.output_paths['Fixed GeoIndex'])
geo_index.fix_geometries(self.output_paths['Fixed GeoIndex'])
geo_index_fixed = \ geo_index_fixed = \
self.initialize_layer(self.output_paths['Fixed GeoIndex'], self.initialize_layer(self.output_paths['Fixed GeoIndex'],
'Fixed GeoIndex') 'Fixed GeoIndex')
@ -78,9 +77,10 @@ class ScrubMTL:
f'({geo_index_clipped.layer_name}) after clipping it ' f'({geo_index_clipped.layer_name}) after clipping it '
f'based on the Montreal Boundary layer: ' f'based on the Montreal Boundary layer: '
f'{geo_index_clipped.layer.featureCount()}') f'{geo_index_clipped.layer.featureCount()}')
def process_property_assesment(self): def process_property_assesment(self):
pass print(f'Data Count of the GeoIndex layer: {self.property_assessment.data_count}')
self.property_assessment.create_spatial_index()
def refine_heights(self): def refine_heights(self):
pass pass