[Qgis-user] QGIS Server: programmatic configuration

Alessandro Pasotti apasotti at gmail.com
Mon Jul 17 06:50:28 PDT 2023


On Mon, Jul 17, 2023 at 3:03 PM Jakob Miksch via QGIS-User <
qgis-user at lists.osgeo.org> wrote:

> Hello everyone,
>
>
>
> To my knowledge it is only possible to change a QGIS server project via
> the QGIS desktop GUI. However, I would like to dynamically add or remove
> layers in a QGIS server project.
>
>
>
> Is there or has there been any approach to accomplish this?
>
> My spontaneous idea is to use pyQGIS to edit the QGIS server project
> directly without using the GUI, but maybe other approaches exist. I would
> be grateful for any experiences, ideas or hints.
>
>
>
> Thanks, and best regards,
>
> Jakob
>

Hi,

you can change a project in memory on each request using server plugins:
https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/server.html,
the project is accessible via QgsProject.instance().

If you want a permanent change to the project you need to rewrite the
project XML on the storage.

Kind regards





>
>
>
> Jakob Miksch
> Consultant
>
> +49 170 9036956
> siticom.online
>
>
>
> siticom GmbH • Werner-von-Siemens-Straße 2-6 • 76646 Bruchsal • Deutschland
> Geschäftsführer: Jürgen Hatzipantelis, Stefan Höltken
> Sitz der Gesellschaft: Weiterstadt • Amtsgericht Darmstadt • HRB 9276
> Umsatzsteuer-ID Nr.: DE 197 925 589
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230717/a0ee2f7a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: siticom-logo-blue-final-black-a-logicalis-company_bc243344-6a69-4e78-9078-76e88dbcc994.png
Type: image/png
Size: 14960 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230717/a0ee2f7a/attachment-0001.png>


More information about the QGIS-User mailing list