Bug report #21528
PostGIS 3D Lines Load as 2D
|Affected QGIS version:||3.6.0||Regression?:||No|
|Operating System:||Windows 10||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||29344|
I created 3-dimensional lines in a PostGIS view. When I load the layer into QGIS (3.4 and 3.6 both tested) it only renders as 2-dimensional. I can see no 3D attributes using either the QGIS 3D Map View or Qgis2threejs plugin. If I export the layer to WKT within QGIS, the linestring only shows X,Y coordinates and no Z coordinates. The Z coordinate is stripped off.
Within PostgreSQL (outside of QGIS), I extracted the same geometry object into WKT (ST_AsText()), and the resulting WKT from the PostGIS view does contain Z coordinates. If I save the results of the PostgreSQL view as a csv file in WKT format, I can then load the csv text version of the layer into QGIS and the lines will render as 3D in both QGIS 3D Map View and Qgis2threejs-created websites.
I tried writing the PostgreSQL view so that it would provide QGIS with the geometry column as WKT only and not make the normal geom object available. It loaded directly from PostGIS to QGIS as a 2D object - once again stripping the 3D attributes from the lines.
It appears that something within the interface to PostgreSQL databases is forcing geometry objects to be loaded as 2D.
I am running QGIS 3.6.0 on a Windows 10 machine, connecting to PostgreSQL version 11.2 on a Windows server (64-bit) with PostGIS 2.5.1 r17027.
#3 Updated by Nate Wanner about 1 year ago
- Status changed from Open to Closed
Problem was with geometry columns in PostGIS, not the QGIS rendering. Was able to view 3D geometries in QGIS by tweaking the SQL language so that the geometry objects in the view were cast to a geometry type.