Bug report #14007

Can't create new features from Postgis Table with Z component

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

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:22020

Description

In QGIS 2.12, having a Postgis table with Z component. It's not possible to add a new features, as it fails to save. Yet, It's possible to edit or copy/paste existing features.

The issue can be replicated by doing the following:

Creating a table in Postgis:

CREATE TABLE test
(
gid serial primary key,
name character varying(100),
geom geometry(MultiPolygonZ,4326)
);

Insert a record:

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 the table in QGIS, start editing and create a new feature.

Trying to save the edits you will get the following error:

Could not commit changes to layer test
Errors: ERROR: 1 feature(s) not added.
Provider errors:
PostGIS error while adding features: ERRO: Column has Z dimension but geometry does not

If you copy paste the features to notepad, you notice that the geometry of the created feature lacks the Z component.

Also, it's impossible to edit the Z component with the new node editor.

This was already happening in QGIS 2.8.

History

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

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

http://osgeo-org.1560.x6.nabble.com/Problem-editing-and-exporting-3D-Postgis-layers-td5240800.html

#2 Updated by Giovanni Manghi about 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#3 Updated by Jürgen Fischer over 6 years ago

  • Assignee deleted (Jürgen Fischer)

#4 Updated by Giovanni Manghi over 6 years ago

  • Resolution set to fixed/implemented
  • Description updated (diff)
  • Status changed from Open to Closed

This particular problem (adding a new feature) seems solved in 2.18.13 and master. There are others anyway in 2.18 that are not there in 2.14 and master:

existing line/polygon features cannot be moved, the node tool is not able to move vertexes and the Z value of nodes cannot be changed.

Will file a new ticket.

Also available in: Atom PDF