Bug report #17814

Postgres provider retrieves 4D geometries as 2D

Added by Martin Dobias over 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:master 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 #:25710

Description

For some reason PostgreSQL provider retrieves 4-dimensional geometries (e.g. POINT ZM) as 2D geometries: the Z and M values are skipped.

To replicate, create a simple view:

CREATE VIEW multipoint_zm_test AS SELECT 1 AS id, ST_GeomFromText('MULTIPOINT', 25832) AS geom;

In identify results, in derived section the "closest vertex z/m" entries are missing. Another way to confirm the bug is to open 3D view and enable 3D renderer for the layer - points are shown at zero elevation.

Postgres provider uses ST_Force2D() when retrieving 4D geometries - looks like it was a fix for an earlier bug #9748. Not sure if the forcing to 2D still makes sense. When "force2d" feature is disabled, things still seem to work.

Here is the place where force2d is turned on for 4D geometries: https://github.com/qgis/QGIS/blob/master/src/providers/postgres/qgspostgresconn.cpp#L1491


Related issues

Related to QGIS Application - Bug report #17789: 3D windows not rendering negative z-values of geometry Closed 2018-01-04

Associated revisions

Revision 6a4b8b47
Added by Martin Dobias over 6 years ago

Fix retrieval of 4D geometries (XYZM) from postgres (fixes #17814)

History

#1 Updated by Nyall Dawson over 6 years ago

I think the force 2d should be dropped - it's inclusion predated the new geometry engine and now it's definitely a bug.

#2 Updated by Mathieu Pellerin - nIRV over 6 years ago

I'm with Nyall, we should drop the force 2D stuff. We've spent quite a lot of effort adding and/or exoosing proper Z/M support to other providers during this cycle, would be a shame not to fix our important postgis provider.

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

  • Related to Bug report #17789: 3D windows not rendering negative z-values of geometry added

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

  • Assignee deleted (Jürgen Fischer)

#5 Updated by Martin Dobias over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#6 Updated by Giovanni Manghi about 6 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF