Bug report #14006

Can't export layers from Postgis tables with Z component geometries

Added by Alexandre Neto over 8 years ago. Updated about 8 years ago.

Assignee:Hugo Mercier
Category:Data Provider/PostGIS
Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22019


In QGIS 2.12, having a layer from a Postgis table with Z component geometries, it's not possible to save as/export the data.

You can test it by creating the following table in Postgis:

gid serial primary key,
name character varying(100),
geom geometry(MultiPolygonZ,4326)

and inserting a record like the following example:

INSERT INTO test (name,geom) VALUES
('polygon 1 single flat', ST_GeomFromText('MultiPolygonZ (((-30.0 42.0 0, -30.0 41.0 0, -29.0 41.0 0, -29.0 42.0 0, -30.0 42.0 0)))',4326));

Open it in QGIS and try to save as. You will get the following error:

Export to vector file failed.
Error: Feature write errors:
Feature geometry not imported (OGR error: )
Only 0 of 1 features written.

This works well in QGIS 2.8.4, therefore I have set it as blocker.

Associated revisions

Revision 4e4743a2
Added by Nyall Dawson over 8 years ago

Fix saving vector layers with z dimension (fix #14006, #12373)


#1 Updated by Pedro Venâncio over 8 years ago

I can confirm this issue. Some information about it with sample data:


#2 Updated by Giovanni Manghi over 8 years ago

is this a regression also compared to #12373 ?

#3 Updated by Hugo Mercier over 8 years ago

Hi. There is a bug indeed. If I am correct, in 2.8 it converted the geometry to 2D before exporting ?
I may be because OGR does not handle 3D geometry correctly

#4 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

#5 Updated by lire lire about 8 years ago

  • Status changed from Closed to Reopened
  • Assignee changed from Jürgen Fischer to Hugo Mercier

In 2.14, features newly created by hand can be saved, but copying data from a layer without Z coordinate and pasting it into a PostGIS Z-layer leads upon saving to an "ERROR: Column has Z dimension but geometry does not" - the same as before.

#6 Updated by Nyall Dawson about 8 years ago

  • Status changed from Reopened to Closed

@lire lire

Please open a new bug report about this - it is unrelated to the original closed report.

Also available in: Atom PDF