[Qgis-user] Storing and Retrieving Vector Layers with Styles to Postgres DB
Etienne Trimaille
etienne.trimaille at gmail.com
Tue Apr 8 03:38:15 PDT 2025
Hi,
A few years ago, I developed a plugin :
https://plugins.qgis.org/plugins/db-style-manager/ to help using styles in
database.
I have used it, but feel free to try it and see if it works.
I see now there is a new one :
https://plugins.qgis.org/plugins/db_style_reloader/
Side note, I would have happily managed a pull request on the plugin to fit
the needs of this "new" plugin.
Regards,
Le lun. 7 avr. 2025 à 12:41, Bo Victor Thomsen via QGIS-User <
qgis-user at lists.osgeo.org> a écrit :
> Hi Peter -
>
> I'm not sure if you're aware of the "Save style as default" function - So
> here comes for a Postgres layer
>
> 1. Load the layer from Postgres
> 2. Style the layer
> 3. Right-click on the layer name in the "Layers" panel
> 4. Click on "Options" -> Button "Style" in the lower leftmost corner
> of the dialog
> 5. Click on "Save as Default" option
> 6. This will show a small dialog "Load default style from" and 3
> buttons
> 7. Click the button name "Datasource Database"
>
> From now on, every time you load the specific table from Postgres as a
> QGIS layer, it will automatically gets the saved style.
>
> It not only the style - It's every information associated to the layer:
> Field definition, attribute form and more.
>
> Med venlig hilsen / Best regards
>
> Bo Victor Thomsen
>
> On 07/04/2025 08.45, peter.berger--- via QGIS-User wrote:
>
> There are serveral steps necessary to store from QGIS a vector layer with
> his style in a postgres DB. For a big amout of layers this is impracticaI.
>
>
>
> Therfore I would do this in one step from QGIS. Is this in any way
> possible?
>
>
>
> *Peter Berger*
>
> Brunnwiesenstrasse 62
>
> 8049 Zürich
>
> Schweiz
>
> mobile +41 79 301 71 54
>
>
>
> The several step procedure:
>
> · *Load the layer*: Import the layer from a vector file into QGIS.
>
> · *Rename (if necessary)*: Give the layer an appropriate name.
>
> · *Transfer the layer to Postgres*: Drag the layer into the PostgreSQL
> database. You will find it there with the specific name.
>
> · *Load the layer from Postgres*: Import it back from the PostgreSQL
> database into QGIS.
>
> · *Assign the style*: Copy the style from the original layer and assign
> it to the Postgres layer loaded in QGIS.
>
> · *Export the style*: Export the style of the Postgres layer. You will
> now find an option to save the style with the exact name of the layer in
> the PostgreSQL database.
>
> · *Delete old layers and reload*: Delete all associated layers and
> reload the layer from the PostgreSQL database.
>
>
>
>
>
> _______________________________________________
> 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/20250408/eeb8feb8/attachment.htm>
More information about the QGIS-User
mailing list