<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello Peter,</p>
    <p>everything that users do in QGis can be done by Python scripts,
      including your steps listed below. <br>
    </p>
    <p>There are some difficulties for the desired "one step" solution,
      f. e. the name of the file-based layer must be converted in a
      valid and unique postgis table-name, the fields of the file-based
      layer must be stored with valid postgis field-types and -names and
      so on...</p>
    <p>Taking into account all special features, exceptions and
      necessary settings, this results in a rather complex program, the
      implementation of which may be more complex than the manual
      implementation in QGis...</p>
    <p>Just my two cents...</p>
    <p>Ludwig<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Am 07.04.25 um 08:45 schrieb
      peter.berger--- via QGIS-User:<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>