Bug report #12010

Can edit Z geom but fail to create it

Added by Remi Cura about 9 years ago. Updated almost 5 years ago.

Affected QGIS version:2.6.1 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:20213


Version of qgis is 2.6.1 on windows 64.
The bug is pretty simple.
Creating a 3D table in postgis, it is possible to edit the 3D geom, but we get an errro when trying to create a new geometry.

test_z_qgis AS
SELECT 1::int AS gid, ST_GeomFRomText('LinestringZ(0 0 0 , 1 1 1, 2 2 2 )',4326)::geometry(linestringZ,4326) AS geom;

Then loading this layer in qgis.
It is possible to edit the geometry
(inserted vertex have 0 Z by the way, it could be interpolated lineary at least).

But when trying to create a new geometry : ERROR : "Column has Z dimension but geometry does not"



#1 Updated by Tudor Bărăscu over 8 years ago

I also encountered this problem in the latest master (2.11).
As QGIS editing tools don't created (currently) 3D features, one solution would be to have triggers that take the 2d line created by QGIS and transform it into a 3d line by reading another attribute column(s) that have z data values.
However, the default way of creating geometry columns in a Postgis database is using type modifier since postgis 2.0.
This gets in the way of the triggers as the geometry constraints are checked before any trigger is run.
But if the geometry column is created using the old check constraints behavior, see http://postgis.net/docs/AddGeometryColumn.html, like this..

SELECT AddGeometryColumn ('schema_name','table_name','geometry_column',SRID,'LINESTRING',3, false);

and if you have a trigger that forces the geometry in 3d (
NEW.geometry := ST_Force3D(NEW.geometry);
then it will work.

All the best

#2 Updated by Tudor Bărăscu over 8 years ago

  • Target version set to Future Release - Nice to have

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

  • Assignee deleted (Jürgen Fischer)
  • Category changed from Data Provider/PostGIS to Vectors

#4 Updated by Jürgen Fischer over 8 years ago

  • Category changed from Vectors to Digitising

#6 Updated by Giovanni Manghi almost 7 years ago

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

#7 Updated by Giovanni Manghi almost 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF