<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Peter -</p>
<p>I'm not sure if you're aware of the "Save style as default"
function - So here comes for a Postgres layer</p>
<ol>
<li>Load the layer from Postgres <br>
</li>
<li>Style the layer <br>
</li>
<li>Right-click on the layer name in the "Layers" panel<br>
</li>
<li>Click on "Options" -> Button "Style" in the lower leftmost
corner of the dialog</li>
<li>Click on "Save as Default" option</li>
<li>This will show a small dialog "Load default style from" and 3
buttons</li>
<li>Click the button name "Datasource Database"</li>
</ol>
<p>From now on, every time you load the specific table from Postgres
as a QGIS layer, it will automatically gets the saved style.</p>
<p>It not only the style - It's every information associated to the
layer: Field definition, attribute form and more. <br>
</p>
<pre class="moz-signature" cols="72">Med venlig hilsen / Best regards
Bo Victor Thomsen</pre>
<div class="moz-cite-prefix">On 07/04/2025 08.45, peter.berger---
via QGIS-User wrote:<br>
</div>
<blockquote type="cite"
cite="mid:71077542.3128.1744008316438@localhost">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"Trebuchet MS";
panose-1:2 11 6 3 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Therfore I would do this in one step from
QGIS. <span lang="FR-CH">Is this in any way possible?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">Peter
Berger<o:p></o:p></span></b></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">Brunnwiesenstrasse
62<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">8049
Zürich<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">Schweiz<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">mobile
+41 79 301 71 54<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH">The
several step procedure:<o:p></o:p></span></p>
<p><span style="font-family:Symbol">·</span><span lang="FR-CH">
</span><strong><span lang="FR-CH"
style="font-family:"Calibri",sans-serif">Load
the layer</span></strong><span lang="FR-CH">: Import the
layer from a vector file into QGIS.<o:p></o:p></span></p>
<p><span style="font-family:Symbol">·</span><span lang="FR-CH">
</span><strong><span lang="FR-CH"
style="font-family:"Calibri",sans-serif">Rename
(if necessary)</span></strong><span lang="FR-CH">: Give
the layer an appropriate name.<o:p></o:p></span></p>
<p><span style="font-family:Symbol">·</span> <strong><span
style="font-family:"Calibri",sans-serif">Transfer
the layer to Postgres</span></strong>: Drag the layer into
the PostgreSQL database. You will find it there with the
specific name.<o:p></o:p></p>
<p><span style="font-family:Symbol">·</span> <strong><span
style="font-family:"Calibri",sans-serif">Load
the layer from Postgres</span></strong>: Import it back
from the PostgreSQL database into QGIS.<o:p></o:p></p>
<p><span style="font-family:Symbol">·</span> <strong><span
style="font-family:"Calibri",sans-serif">Assign
the style</span></strong>: Copy the style from the
original layer and assign it to the Postgres layer loaded in
QGIS.<o:p></o:p></p>
<p><span style="font-family:Symbol">·</span> <strong><span
style="font-family:"Calibri",sans-serif">Export
the style</span></strong>: 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.<o:p></o:p></p>
<p><span style="font-family:Symbol">·</span> <strong><span
style="font-family:"Calibri",sans-serif">Delete
old layers and reload</span></strong>: Delete all
associated layers and reload the layer from the PostgreSQL
database.<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:8.0pt;font-family:"Trebuchet MS",sans-serif;mso-ligatures:none;mso-fareast-language:DE-CH"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
QGIS-User mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
</body>
</html>