[Qgis-user] PostGIS raster layer filtered by attribute
Dirk.Pispers at STADT-KOELN.DE
Dirk.Pispers at STADT-KOELN.DE
Fri Nov 4 04:18:17 PDT 2022
Thanks to Thayer and Alesandro.
I made a lot of tests today. Not all is working, but it's on a good way.
I did not see the "Filter" option on the raster layer in QGIS 3.22 because I searched in the layer properties analog to where the filter is placed for vector layers.
The filter option works in general but throws a lot of critical errors, when no raster is in the result of the filter query.
Another solution I tried is to use a view where the raster table is filtered.
This works in QGIS 3.10 but not in 3.22, where QGIS generates an invalid query against the PostgreSQL catalog when adding the raster layer.
Regards Dirk
-----Ursprüngliche Nachricht-----
Von: Alessandro Pasotti [mailto:apasotti at gmail.com]
Gesendet: Donnerstag, 3. November 2022 15:11
An: Thayer Young <thayeray at yahoo.com>
Cc: qgis-user at lists.osgeo.org; Pispers, Dirk <Dirk.Pispers at STADT-KOELN.DE>
Betreff: Re: [Qgis-user] PostGIS raster layer filtered by attribute
Right click on the raster in the legend and choose "Filter..."
On Thu, Nov 3, 2022 at 2:58 PM Thayer Young via Qgis-user <qgis-user at lists.osgeo.org> wrote:
>
> Hi Dirk,
>
> I have looked into this and found no easy solution. As you have noticed there is no "Provider Feature Filter" in the Source tab of the layer properties for a raster layer. The next obvious path would be to write a SELECT statement in an SQL Window in the Database Manager and "Load as New Layer", but this is only set up for geometry columns, not raster. Next is to create a view or a materialized view with the associated indexes in the database and try adding that to QGIS using the four methods for adding layers. All of these result in the same PostGIS errors, that a primary key can not be found for the raster table, that the raster layer is invalid and that the "Data type size for band 1 could not be found: num bands is: 0 and the type size map for bands contains: 0 item(s)".
>
> I have searched the QGIS issues page on Github and not found anything beyond the basic functionality of adding PostGIS rasters. I believe that if you are interested in this functionality you should file a feature request on the qgis/QGIS issues page on Github.
>
> This is what I found, note that all of the issues are closed:
> https://github.com/qgis/QGIS/issues?q=is%3Aissue+postgresraster+
>
> -Thayer
>
>
>
> > Date: Wed, 2 Nov 2022 12:08:08 +0000
> > From: <Dirk.Pispers at STADT-KOELN.DE>
> > To: <qgis-user at lists.osgeo.org>
> > Subject: [Qgis-user] PostGIS raster layer filtered by attribute
> > Message-ID: <8766215b88b84d3ba770e6c0a7979d93 at STADT-KOELN.DE>
> >Content-Type: text/plain; charset="us-ascii"
> >
> >Hi list,
> >
> > I import TIFF-files into a PostgreSQL/PostGIS table with FME. In addition to the raster column my table has some more columns.
> > Is it possible to filter the raster layer based on my table by these additional columns?
> > It seems that QGIS (up to 3.28) doesn't handle addional columns in raster layers, but maybe someone knows a trick to do so.
> > Thanks and regards
> >
> > Dirk
>
> _______________________________________________
> 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
--
Alessandro Pasotti
QCooperative: www.qcooperative.net
ItOpen: www.itopen.it
More information about the Qgis-user
mailing list