Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Postgis tables with multiple geometry types with Z #32119

Closed
jgrocha opened this issue Oct 4, 2019 · 0 comments · Fixed by #32125
Closed

Support for Postgis tables with multiple geometry types with Z #32119

jgrocha opened this issue Oct 4, 2019 · 0 comments · Fixed by #32125
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin

Comments

@jgrocha
Copy link
Member

jgrocha commented Oct 4, 2019

Support for Postgis tables with multiple geometry types

When a Postgis table has more than one kind of geometry (Point, LineString, Polygon), DB Manager allow the user to add a layer with just Point features, or with just Polygon features, for example.

That behaviour is illustrated in the following DB Manager dialogue, where we can see three different layers that can be added for the same Potsgis table edificio.

Captura de ecrã de 2019-10-04 14-32-34

This works well, if the geometry are only 2d.

Describe the bug

If the Postgis table has Z geometry (geometry with 3D), the layers are added to QGIS without the Z component. If the Postgis table has points with Z, lines with Z or polygons with Z, the layers are added, but the Z component is lost.

How to Reproduce

To reproduce this limitation, we need to create a Postgis table with the geometry type with 3 dimensions.

CREATE TABLE public.curso_de_agua_z (
	identificador uuid NOT NULL DEFAULT uuid_generate_v1mc(),
	inicio_objeto timestamp NOT NULL,
	fim_objeto time NULL,
	delimitacao_conhecida bool NOT NULL,
	CONSTRAINT curso_de_agua_z_pkey PRIMARY KEY (identificador)
);

SELECT AddGeometryColumn ('public','curso_de_agua_z','geometria',3763,'GEOMETRY',3);

Add layer to QGIS

The previous table is shown and can be added to QGIS, using DB Manager.

layer has 3d

The layer is reported as having 3 dimensions.

Added layer does not have 3 dimensions

After adding the layer, it does not preserve the 3 dimensions.

This can be checked immediately on the layer tree (mouse over the layer with report it as Polygon, not as PolygonZ, for example).

Editing the layer, and showing the vertice editor, the 3 dimension does not appear.

Captura de ecrã de 2019-10-04 14-49-45

QGIS and OS versions

Tested with 3.8.1-Zanzibar

POSTGIS="2.5.2 r17328" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0 673b9939" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.3.2, released 2018/09/21" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" RASTER

Additional context

Support for 3D works, if the Postgis table has only one kind of geometry.

@jgrocha jgrocha added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 4, 2019
@m-kuhn m-kuhn added the DB Manager Relating to the DB Manager core plugin label Oct 4, 2019
m-kuhn added a commit to m-kuhn/QGIS that referenced this issue Oct 6, 2019
When a layer has a generic "GEOMETRY" type, it will only be listed once in the db_manager
but with an additional context menu entry for advanced properties, where one can select
the geometry type and the CRS.

Fix qgis#32119
References qgis#30787
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants