@@ -148,6 +148,7 @@ def compute(self, line1, line2, field1, field2, outPath, progressBar):
148
148
149
149
index = ftools_utils .createIndex ( provider2 )
150
150
151
+ singlelayer_tempList = []
151
152
fit1 = provider1 .getFeatures ( QgsFeatureRequest ().setSubsetOfAttributes ([index1 ]) )
152
153
while fit1 .nextFeature (inFeat ):
153
154
inGeom = inFeat .geometry ()
@@ -169,10 +170,19 @@ def compute(self, line1, line2, field1, field2, outPath, progressBar):
169
170
tempList .append (tempGeom .asPoint ())
170
171
171
172
for j in tempList :
172
- outFeat .setGeometry (tempGeom .fromPoint (j ))
173
- outFeat .setAttribute (0 , v1 )
174
- outFeat .setAttribute (1 , v2 )
175
- writer .addFeature (outFeat )
173
+ # if same layer, avoid insert duplicated points
174
+ if line1 == line2 :
175
+ if not j in singlelayer_tempList :
176
+ singlelayer_tempList .append (j )
177
+ outFeat .setGeometry (tempGeom .fromPoint (j ))
178
+ outFeat .setAttribute (0 , v1 )
179
+ outFeat .setAttribute (1 , v2 )
180
+ writer .addFeature (outFeat )
181
+ else :
182
+ outFeat .setGeometry (tempGeom .fromPoint (j ))
183
+ outFeat .setAttribute (0 , v1 )
184
+ outFeat .setAttribute (1 , v2 )
185
+ writer .addFeature (outFeat )
176
186
177
187
start = start + add
178
188
progressBar .setValue (start )
0 commit comments