[QGIS-Developer] Inserting provider filter just before PostGIS layer is loaded?

Johannes Kröger (WhereGroup) johannes.kroeger at wheregroup.com
Tue Aug 30 08:59:09 PDT 2022


Thank you for the idea! The goal is to sneakily jump in when the user is 
adding any layer though (without them caring about anything, without any 
rules they have to follow). I'll post our solution in the main thread in 
a moment.

Cheers, Hannes

Am 22.08.22 um 12:11 schrieb Jacky Volpes:
> Hi,
>
> I don't know any way to do this, except for using a workaround.
> But it will depend on your use-case.
> Maybe using query layers, such as
>
> QgsVectorLayer("table='(select * from <schema>.<table> <your 
> conditions>)' service='<service>' key='<unique id column>'", "<table 
> name>", "postgres")
>
> can help ?
>
> Regards,
> Jacky
>
>
>
> Le 09/08/2022 à 11:15, Johannes Kröger (WhereGroup) via QGIS-Developer 
> a écrit :
>> Howdy!
>>
>> I'd like to force a provider filter when a user adds a PostGIS layer 
>> and have it applied *before* any data is loaded. Setting it after the 
>> layer (and some of its big data) is loaded initially is not an option.
>>
>> Is there a way to sneak in between "user clicked something in the GUI 
>> to load a table/query and QGIS will construct a QgsVectorLayer now" 
>> and "QGIS now talks to the PostGIS database to get the data for the 
>> new layer", maybe with a signal?
>>
>> Something like a "layerAboutToBeLoaded" (like the opposite 
>> layerWillBeRemoved on 
>> https://qgis.org/pyqgis/master/core/QgsProject.html) basically. :o)
>>
>> Cheers, Hannes
>>
>>
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
> -- 
> Jacky Volpes
>
> Ingénieur SIG - Oslandia

-- 
Johannes Kröger / GIS-Entwickler/-Berater

---------------------------------------------
Schon gewusst?
In unserem Blog geben wir Tipps & Tricks zu Open-Source-GIS-Software
und berichten aus unserem Experten-Alltag:
https://wheregroup.com/blog/
---------------------------------------------

WhereGroup GmbH
Grevenweg 89
20537 Hamburg
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

johannes.kroeger at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885
-------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220830/24103983/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x840A4B843789797F.asc
Type: application/pgp-keys
Size: 2472 bytes
Desc: OpenPGP public key
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220830/24103983/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 665 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220830/24103983/attachment.sig>


More information about the QGIS-Developer mailing list