Bug report #14640

Updated by Alessandro Pasotti over 5 years ago

As I understand from section 7 of http://www.opengeospatial.org/standards/sfa, empty geometries in WKT format should be specified as, for example "MultiLineString EMPTY".



Using QgsGeometry.fromWkt() works as expected in QGIS 2.8.3, but not in QGIS 2.14.1. See Python console output below:



QGIS 2.8.3 Wien:



>>>g = QgsGeometry.fromWkt('MultiLineString EMPTY')

>>>print g

<qgis._core.QgsGeometry object at 0x0000000018DC0BF8>

>>>g.exportToWkt()

u'MULTILINESTRING()'



>>>g = QgsGeometry.fromWkt('MultiLineString')

>>>print g

None

>>>g.exportToWkt()

Traceback (most recent call last):

File "<input>", line 1, in <module>

AttributeError: 'NoneType' object has no attribute 'exportToWkt'



QGIS 2.14.1 Essen:



>>>g = QgsGeometry.fromWkt('MultiLineString EMPTY')

>>>print g

None

>>>g.exportToWkt()

Traceback (most recent call last):

File "<input>", line 1, in <module>

AttributeError: 'NoneType' object has no attribute 'exportToWkt'



>>>g = QgsGeometry.fromWkt('MultiLineString')

>>>print g

<qgis._core.QgsGeometry object at 0x0000000018EA3E18>

>>>g.exportToWkt()

u'MultiLineString ()'



Back