[Qgis-user] PostGIS Views in QGIS 3.10
Alexandre Neto
senhor.neto at gmail.com
Thu May 14 06:18:50 PDT 2020
At least, 4 things can go "wrong" between QGIS and postgis views, which
result in the yellow warnings.
1 - theres no "id" column or it has repeated values;
fix it or create a identifiers on the fly with rownumber() over() as id
2 - QGIS was not able to guess which column to use for unique identifiers;
Call it "id" and make sure it's the first column in the result.
3 - The view returns columns with the same name;
Use alias to change the column names.
SELECT a.id, a.name, b.name as name2
4 - The view transform the original geometries (for example because you
used a function like st_buffer around it) and QGIS does not know what
geometry type and SRID to use: cast the geometry columns with expected
geometry type. Like this:
st_buffer(geom, 10)::geometry(POLYGON, 3763)
Hope it helps.
Alexandre Neto
QGIS Support
www.qcooperative.net
A quinta, 14/05/2020, 09:14, Andreas Neumann <a.neumann at carto.net> escreveu:
> Hi Vera,
>
> As far as I know, the yellow triangle means that either something is wrong
> with the layer, or that it needs a user input, such as "choosing a primary
> key column" in case of a view.
>
> It basically means that the layer can't be loaded, unless the user
> provides a hint to QGIS how to correctly load the layer.
>
> I don't think you can configure QGIS to not display these yellow triangles
> for views. I also think they are useful indicator to the users, that they
> need to do something.
>
> It could also be a missing SRID, or something else.
>
> Andreas
>
>
> Am 14.05.20 um 09:22 schrieb Vera Diaz-Köhli:
>
> Hello
>
>
>
> We have made some views in our PostGIS-Database, so that it is easier for
> our users to access the data.
>
> The views have a column with a unique id ( Y ID).
>
>
>
> In the «Add PostGIS-Layer» dialog, all those view are listed, with the
> field «Object-ID» filled in correctly ( > ID) and they can be added to the
> map. However, there’s a little yellow triangle in front of their names,
> which only disappears, when I click in the field «Object-ID».
>
>
>
> How can I get rid of those yellow triangles? They are quite confusing for
> our user, even though the views do work…
>
>
>
> Thanks in advance
>
> Vera
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing listQgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20200514/d563e10e/attachment.html>
More information about the Qgis-user
mailing list