Error creating events: index 0 has type 'NoneType' but 'QgsPointXY' is expected
Closed this issue · 1 comments
When creating events (via the "Events" tab of the plugin) from certain datasets, processing will fail with an error message like the following:
2018-07-28T20:13:28 WARNING Traceback (most recent call last):
File "C:/.../QGIS/QGIS3\profiles\default/python/plugins\lrs\ui\lrsdockwidget.py", line 996, in createEvents
events.create(layer, featuresSelect, routeFieldName, startFieldName, endFieldName, errorFieldName, outputName)
File "C:/.../QGIS/QGIS3\profiles\default/python/plugins\lrs\lrs\lrsevents.py", line 105, in create
geo = QgsGeometry.fromMultiPolylineXY(line)
TypeError: index 0 has type 'NoneType' but 'QgsPointXY' is expected
This occurs when the dataset specifies a linear event of a directionality opposite to that of the route it references; that is, a linear event that has a "start" measure greater than its "end" measure. It seems this violates an assumption made by the plugin.
Directionality does matter in certain applications. For instance, when modeling the movement of a vehicle through a road network, it normally is important to know not just what portion of a road segment the vehicle traversed but in which direction it moved. Consequently, it would be useful for the plugin to support the creation of events of either directionality.
Fixed using Simon's pull request.