[Qgis-developer] QGIS QgsGeometry.fromWkt not accepting polygons with Z values?

Casper Børgesen (CABO) CABO at NIRAS.DK
Mon Jun 29 01:51:58 PDT 2015


Hi!

I have previously been able to use the QGIS plugin QuickWKT to conveniently visualize geometries in QGIS. This has worked well using both 2D and 3D data where only the 2D part has been visualized. Recently I haven't been able to insert WKT polygons with Z-values.

I have tried the following in the Python console:

> g = QgsGeometry.fromWkt('Polygon((0 0 0, 0 1 0, 1 1 0, 0 0 0))')
> f = QgsFeature()
> f.setGeometry(g)
> iface.activeLayer().dataProvider().addFeatures([f])

My active layer is a scratch layer configured as Polygon. I get no exceptions and QGIS reports the layer containing 1 feature but nothing is shown. I have altered the above four python lines to only have the X and Y values and this results in a visual result.

Repeating the above using a Point WKT instead works fine with both 2D and 3D data.

Is something broken in the WKT parser for polygons?

I am using the weekly QGIS windows x64 release 61d81f0 and I wonder if this has something to do with the new geometry classes Marco wrote about on this list in late May 2015?


Regards, Casper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150629/9e9c9d71/attachment.html>


More information about the Qgis-developer mailing list