diff --git a/ORStools/proc/export_proc.py b/ORStools/proc/export_proc.py index 40caf4a5..ab14b767 100644 --- a/ORStools/proc/export_proc.py +++ b/ORStools/proc/export_proc.py @@ -116,18 +116,16 @@ def processAlgorithm( to_coords = self.get_location_by_id(to_id, response["nodes"]) from_coords = self.get_location_by_id(from_id, response["nodes"]) - geometry = QgsGeometry.fromPolylineXY([QgsPointXY(from_coords[0], from_coords[1]), - QgsPointXY(to_coords[0], to_coords[1])]) - - feat = QgsFeature() - feat.setGeometry(geometry) - feat.setAttributes( + geometry = QgsGeometry.fromPolylineXY( [ - from_id, - to_id, - weight + QgsPointXY(from_coords[0], from_coords[1]), + QgsPointXY(to_coords[0], to_coords[1]), ] ) + + feat = QgsFeature() + feat.setGeometry(geometry) + feat.setAttributes([from_id, to_id, weight]) sink.addFeature(feat) except (exceptions.ApiError, exceptions.InvalidKey, exceptions.GenericServerError) as e: @@ -135,7 +133,6 @@ def processAlgorithm( feedback.reportError(msg) logger.log(msg) - return {self.OUT: dest_id} @staticmethod @@ -159,13 +156,10 @@ def get_location_by_id(self, node_id, nodes): list: The location of the node, or None if the node ID is not found. """ for node in nodes: - if node['nodeId'] == node_id: - return node['location'] + if node["nodeId"] == node_id: + return node["location"] return None - - - def displayName(self) -> str: """ Algorithm name shown in QGIS toolbox