Feature request #7706

Geometry constructors (EWKT/EWKB)

Added by Denis Rouzaud about 4 years ago. Updated about 4 years ago.

Status:OpenStart date:04/25/2013
Priority:HighDue date:
Assignee:-% Done:


Target version:Future Release - High Priority
Platform: Resolution:
Platform version: Pull Request or Patch supplied:No
Status info: Tag:


Right now, only WKT/WKB can be used to import/export geometries.

It would be great to have EWKT and EWKB import/export methods, to avoid complex stuff as in [0]

[0] https://github.com/elpaso/quickwkt/blob/73870168d09589a9ab8d54f7d695e548c26e7751/QuickWKT.py#L144


#1 Updated by Matthias Kuhn about 4 years ago

I discussed this topic a while ago on IRC with jef.

The main point for not including this was, that the SRID must not be lost within this process. When loading as geometry column in a layer, this information is preserved in the layer SRID, but the geometry itself has no such variable.

I see two approaches to this:
  • specifying the SRID as additional parameter for QgsGeometry::exportToEWk[t|b]( int SRID ) and passing an additional reference int& SRID to QgsGeometry::fromToEWk[t|b]() where the SRID will be written to.
  • creating a new class QgsReferencedGeometry (or QgsEGeometry as in *E*WKT) which inherits QgsGeometry and holds an additional variable for the SRID.

Also available in: Atom PDF