Complete first trial
This commit is contained in:
parent
546344fbb4
commit
2d7a37f250
|
@ -19,6 +19,24 @@ duplcated = 'C:/Users/a_adli/PycharmProjects/varennes_gis_oo/' \
|
|||
|
||||
# First, the layer will be duplicated as some records are going to be removed
|
||||
|
||||
nrcan_varennes = ScrubLayer(qgis_path, nrcan_varennes, 'NRCan Varennes')
|
||||
nrcan_varennes_duplicate = nrcan_varennes.duplicate_layer(
|
||||
varennes_nrcan = ScrubLayer(qgis_path, nrcan_varennes, 'NRCan Varennes')
|
||||
varennes_nrcan_duplicate = varennes_nrcan.duplicate_layer(
|
||||
duplcated, 'NRCan duplicated')
|
||||
|
||||
tolerance = 5
|
||||
varennes_nrcan_features = varennes_nrcan.layer.getFeatures()
|
||||
varennes_nrcan_duplicate_features = \
|
||||
varennes_nrcan_duplicate.layer.getFeatures()
|
||||
|
||||
for feature in varennes_nrcan_features:
|
||||
for next_feature in varennes_nrcan_duplicate_features:
|
||||
if feature['feature_id'] == next_feature['feature_id']:
|
||||
continue
|
||||
if abs(feature['centroid_x'] - next_feature['centroid_x']) < tolerance\
|
||||
or \
|
||||
abs(
|
||||
feature['centroid_y'] - next_feature['centroid_y']
|
||||
) < tolerance:
|
||||
record_id = next_feature.id()
|
||||
varennes_nrcan_duplicate.delete_record_by_index(record_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user