I have a table in postgresql with mixed geometry, but it is not accessible in QGIS. I am running QGIS version 2.8.2. Is there any plugin to install for QGIS to render multiple geometry?

  • 1
    You speak about mixed geometries and multiple geometries, which ones do you have, or both? Mixed= feature has only one geometry but it can be point, line, polygon etc. Multiple= one feature may have many geometries, for example both polygon and point geometries. – user30184 May 23 '16 at 6:07

You can create views on your table to access the different geometry types as separate layers in QGIS, for example:

CREATE VIEW parcel_polygons AS
SELECT id, name, geom::geometry(MultiPolygon, 4326)
FROM parcels
WHERE GeometryType(geom) = 'MULTIPOLYGON';

CREATE VIEW parcel_points AS
SELECT id, name, geom::geometry(Point, 4326)
FROM parcels
WHERE GeometryType(geom) = 'POINT';

Note the typecast from a generic geometry type (geometry) to a specific geometry type (geometry(Point, 4326)). This helps client applications, like QGIS, understand what geometry type is exposed by the view.

Different versions of QGIS load views with varying degrees of success. If you have difficulty loading the view using the "Add PostGIS Layers" dialog, give the "DB Manager" method a try too.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.