Hey!
I've written this Python script that is comparing three diffrent path distances from a starting point and the three nearest target Points, and choosing the shortest one to be output. Does anyone have a clue if I can make it more efficient? Atm it takes a long time since it iterates through ca 82000*82000 features...
Â
class FeatureProcessor(object):Â
def __init__(self):Â
self.featureList = []Â
Â
def input(self,feature):Â
self.featureList.append(feature)Â
Â
def close(self):Â
r = int(len(self.featureList)/3)Â
for i in range(1, r+1):Â
valueList = []Â
nearestList = []Â
for feature in self.featureList:Â
j = int(feature.getAttribute('gid'))Â
if j == i:Â
nearestList.append(feature)Â
for feature in nearestList:Â
value = feature.getAttribute('Totalt_AvstÃ¥nd')Â
valueList.append(value)Â
minValue = min(valueList)Â
for feature in nearestList:Â
if feature.getAttribute('Totalt_AvstÃ¥nd') == minValue:Â
self.pyoutput(feature)Â
If someone has a different solution than using Python for this, please feel free to suggest it!
Thank you!



