This commit is contained in:
Alireza Adli 2024-02-26 12:39:52 -05:00
parent 42e23e12f4
commit 0c61c45491

View File

@ -69,12 +69,18 @@ geoindex_layer = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/da
geoindex, geoindex_name = load_layer(geoindex_layer, 'GeoIndex')
print(f'{geoindex_name} data count: {geoindex.featureCount()}')
params_create_index_geo = {'INPUT': geoindex_layer, 'OUTPUT': 'Output'}
processing.run("native:createspatialindex", params_create_index_geo)
# Fixing the GeoIndex layer geometries
print(f'Fixing {geoindex_name} geometries')
fixed_geoindex = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/output_data/fixed_geoindex/fixed_geoindex.shp'
params_fixing_geoindex = {'INPUT': geoindex, 'METHOD': 0, 'OUTPUT': fixed_geoindex}
processing.run("native:fixgeometries", params_fixing_geoindex)
params_create_index_fixed_geo = {'INPUT': fixed_geoindex, 'OUTPUT': 'Output'}
processing.run("native:createspatialindex", params_create_index_fixed_geo)
fixed_geoindex_read, fixed_geoindex_name = load_layer(fixed_geoindex, 'Fixed NRCan')
print(f'{fixed_geoindex_name} data count: {fixed_geoindex_read.featureCount()}')
@ -237,4 +243,25 @@ property_assessment_nrcan_geo, property_assessment_nrcan_geo_name = \
load_layer(property_assessment_nrcan_geo_layer, 'Property Assessment Layer Joined with NRCan')
print(f'{property_assessment_nrcan_geo_name} data count: {property_assessment_nrcan_geo.featureCount()}')
# ---
# There are four steps that will be added later after testing the program:
# - Aligning GeoIndex layer/features with Property Assessment (We should, firstly, make sure about its benefit)
# - Count overlapping features
# - Summarize within
# - Adding the summarize-within field with a spatial join
# ---
# In QGIS Delete Identical is named Delete Duplicates
property_nrcan_geo_deleted_duplicates_layer = 'C:/Users/a_adli/PycharmProjects/hydroquebec_archetype_gispy/data/output_data/deleted_duplicates_property_and_all/delete_duplicates.shp'
delete_duplicates_params = {'INPUT': property_assessment_nrcan_geo_layer,
'OUTPUT': property_nrcan_geo_deleted_duplicates_layer}
processing.run("native:deleteduplicategeometries", delete_duplicates_params)
create_index_params = {'INPUT': property_nrcan_geo_deleted_duplicates_layer, 'OUTPUT': 'Output'}
processing.run("native:createspatialindex", create_index_params)
property_nrcan_geo_deleted_duplicates, property_nrcan_geo_deleted_duplicates_name = \
load_layer(property_nrcan_geo_deleted_duplicates_layer, 'Property Assessment Layer Joined with NRCan')
print(f'{property_nrcan_geo_deleted_duplicates_name} data count: {property_nrcan_geo_deleted_duplicates.featureCount()}')
qgs.exitQgis()