@@ -103,11 +103,13 @@ def processAlgorithm(self, parameters, context, feedback):
103
103
pt = QgsGeometry .fromWkt (stop .geometry .wkt )
104
104
f = QgsFeature ()
105
105
f .setGeometry (pt )
106
- attrs = [
107
- stop .stop_id ,
108
- stop .stop_code ,
109
- stop .stop_name
110
- ]
106
+ attrs = [stop .stop_id ]
107
+ if hasattr (stop , 'stop_code' ):
108
+ attrs .append (stop .stop_code )
109
+ else :
110
+ attrs .append ('' )
111
+ attrs .append (stop .stop_name )
112
+
111
113
f .setAttributes (attrs )
112
114
self .sink_stops .addFeature (f , QgsFeatureSink .FastInsert )
113
115
@@ -120,6 +122,11 @@ def get_fields(self):
120
122
fields .append (QgsField ("stop_name" , QVariant .String ))
121
123
return fields
122
124
125
+ def postProcessAlgorithm (self , context , feedback ):
126
+ stop_layer = QgsProcessingUtils .mapLayerFromString (self .dest_stops , context )
127
+ stop_layer .loadNamedStyle (os .path .join (pluginPath , "styles" , "gtfs-stops.qml" ))
128
+ return {self .OUTPUT : self .dest_stops }
129
+
123
130
124
131
class GtfsShapesAlgorithm (QgsProcessingAlgorithm ):
125
132
INPUT = "INPUT"
@@ -333,3 +340,8 @@ def get_fields(self, add_avg_speed):
333
340
fields .append (QgsField ("segment_max_speed_kmh" , QVariant .Double ))
334
341
fields .append (QgsField ("runtime_sec" , QVariant .Double ))
335
342
return fields
343
+
344
+ def postProcessAlgorithm (self , context , feedback ):
345
+ seg_layer = QgsProcessingUtils .mapLayerFromString (self .dest_segments , context )
346
+ seg_layer .loadNamedStyle (os .path .join (pluginPath , "styles" , "gtfs-segments.qml" ))
347
+ return {self .OUTPUT : self .dest_segments }
0 commit comments