<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:"Open Sans";}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Lato;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
h2
{mso-style-priority:9;
mso-style-link:"Überschrift 2 Zchn";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:18.0pt;
font-family:"Calibri",sans-serif;
font-weight:bold;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.berschrift2Zchn
{mso-style-name:"Überschrift 2 Zchn";
mso-style-priority:9;
mso-style-link:"Überschrift 2";
font-family:"Calibri",sans-serif;
font-weight:bold;}
span.productname
{mso-style-name:productname;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1586450399;
mso-list-type:hybrid;
mso-list-template-ids:-824808294 134676481 134676483 134676485 134676481 134676483 134676485 134676481 134676483 134676485;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></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]--></head><body lang=DE-CH link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hallo zusammen<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Ich möchte euch noch gerne meine Erfahrungen mit dem der pg_service.conf teilen. Dabei beziehe ich mich auf Linux. Es ist nämlich etwas tricky.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Offiziell findet man in der Postgres-Dokumentation dies:<o:p></o:p></span></p><h2 style='mso-margin-top-alt:12.0pt;margin-right:0cm;margin-bottom:12.0pt;margin-left:0cm'><span lang=EN-US style='font-size:17.5pt;font-family:"Open Sans",sans-serif'>The Connection Service File <o:p></o:p></span></h2><p style='margin-top:0cm;box-sizing: border-box;margin-bottom:1rem;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);-webkit-text-size-adjust: 100%'><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>The connection service file allows libpq connection parameters to be associated with a single service name. That service name can then be specified in a libpq connection string, and the associated settings will be used. This allows connection parameters to be modified without requiring a recompile of the libpq-using application. The service name can also be specified using the </span><code><span lang=EN-US style='font-size:9.0pt'>PGSERVICE</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'> environment variable.<o:p></o:p></span></p><p style='margin-top:0cm'><a name=id-1.7.3.24.2></a><a name=id-1.7.3.24.3></a><a name=id-1.7.3.24.4></a><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>Service names can be defined in either a per-user service file or a system-wide file. If the same service name exists in both the user and the system file, the user file takes precedence. By default, the per-user service file is named </span><code><span lang=EN-US style='font-size:9.0pt'>~/.pg_service.conf</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>. On Microsoft Windows, it is named </span><code><span lang=EN-US style='font-size:9.0pt'>%APPDATA%\postgresql\.pg_service.conf</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>(where </span><code><span lang=EN-US style='font-size:9.0pt'>%APPDATA%</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'> refers to the Application Data subdirectory in the user's profile). A different file name can be specified by setting the environment variable </span><code><span lang=EN-US style='font-size:9.0pt'>PGSERVICEFILE</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>. The system-wide file is named </span><code><span lang=EN-US style='font-size:9.0pt'>pg_service.conf</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>. By default it is sought in the </span><code><span lang=EN-US style='font-size:9.0pt'>etc</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'> directory of the <span class=productname>PostgreSQL</span> installation (use </span><code><span lang=EN-US style='font-size:9.0pt'>pg_config --sysconfdir</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'> to identify this directory precisely). Another directory, but not a different file name, can be specified by setting the environment variable </span><code><span lang=EN-US style='font-size:9.0pt'>PGSYSCONFDIR</span></code><span lang=EN-US style='font-size:9.0pt;font-family:"Open Sans",sans-serif'>.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Meine Erfahrungen:<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><ul style='margin-top:0cm' type=disc><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span style='mso-fareast-language:EN-US'>Zuerst habe ich mir in der User <span style='background:lime;mso-highlight:lime'>HOME-Verzeichnis ein </span></span><code><span style='font-size:10.0pt;background:lime;mso-highlight:lime'>~/.pg_service.conf</span></code><code><span style='font-size:10.0pt'> </span></code><span style='mso-fareast-language:EN-US'>File angelegt. Dann hat es in QGIS funktioniert. In QGIS muss man dann eigentlich in den PostgeSQL-Settings nur den Service eintragen und es funktioniert.<o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'><span style='mso-fareast-language:EN-US'>Dann habe ich Lizmap geöffnet und da meckert Lizmap bei den Checks. </span><span lang=EN-US style='mso-fareast-language:EN-US'>Nach Abschalten in den Services, </span><span lang=EN-US>«Prevent PostgresSQL layers from using a service file» waren die Checks OK. (Komischer Check!)</span><span lang=EN-US style='mso-fareast-language:EN-US'><o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Im Web war dann der Postgres-Layer wiederum nicht zu sehen. Hmm.. Dann die Erleuchtung, dass der QGIS-Server ja nicht als gleicher User läuft und somit er das <code><span style='font-size:10.0pt'>~/.pg_service.conf File </span></code>im Verzeichnis des anderen User nicht sieht. Also müsste ich das File an mehreren Ort haben. Nicht praktikabel!<o:p></o:p></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Ich habe dann entschieden, dass ich das Ganze systemweit verfügbar mache indem ich <code><span style='font-size:10.0pt'>pg_config –sysconfdir </span></code>aufrufe. Da kommt dies raus<code><span style='font-size:10.0pt'> /etc/postgresql-common</span></code>. Nun habe ich das File <code><span style='font-size:10.0pt'>~/.pg_service.conf </span></code>in diesen Ordner kopiert. Funktionierte nicht! Hmm… Aha, das File hat dort einen anderen Namen nicht <code><span style='font-size:10.0pt;background:red;mso-highlight:red'>~/.pg_service.conf</span></code><code><span style='font-size:10.0pt'> </span></code>sondern <code><span style='font-size:10.0pt;background:lime;mso-highlight:lime'>~/pg_service.conf</span></code>. Also ohne führenden Punkt. Nun hat es funktioniert!<span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></li><li class=MsoListParagraph style='margin-left:0cm;mso-list:l0 level1 lfo1'>Man kann den Bezug auf das File auch in der Environment Variable PGSERVICEFILE definieren. Ob das funktioniert habe ich bis jetzt nicht ausprobiert. Hat jemand Erfahrung damit?<o:p></o:p></li></ul><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Etwas mühsam ist dies jedoch, wenn man ein QGIS-File auf einem System ohne Postgreszugang aufruft. Dann funktionieren die Postgres-Layer nicht.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Gruss, Peter<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=DE>Von:</span></b><span lang=DE> Lizmap-de <lizmap-de-bounces@lists.osgeo.org> <b>Im Auftrag von </b>Peter Berger via Lizmap-de<br><b>Gesendet:</b> Donnerstag, 28. März 2024 14:53<br><b>An:</b> Jörg Thomsen <joerg.thomsen@wheregroup.com><br><b>Cc:</b> lizmap-de@lists.osgeo.org<br><b>Betreff:</b> Re: [Lizmap-de] Lizmap Rechte für Postgres-Layer direkt in das QGIS-File einbinden<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hallo Jörg<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Vielen Dank für deinen Beitrag. Wir haben also diese Möglichkeiten: <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Die Credentials in ein dezidiertes File einzubinden, pg_service.conf.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>In ein QGIS-File händisch pro Layer einzutragen.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Und via QGIS in einer Konfiguration einzutragen. Dies funktioniert bei mir jedoch nicht! Sollte doch? Hat QGIS, mindestens bei den 3.34.x Versionen einen Bug?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Wie immer, das mit dem pg_service.conf funktioniert. Ich werde in Zukunft diesen Weg gehen. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Liebe Grüsse<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Peter<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal style='margin-bottom:12.0pt'>Am 28.03.2024 um 08:42 schrieb Jörg Thomsen via Lizmap-de <<a href="mailto:lizmap-de@lists.osgeo.org">lizmap-de@lists.osgeo.org</a>>:<o:p></o:p></p></blockquote></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal> <o:p></o:p></p><div><p class=MsoNormal>Moin,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>ein Zwischenruf von der Seite.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><p>> Da ist zwar noch ein weiteres File dabei, ich hab aber nie rausgefunden, wofür das ist. <o:p></o:p></p><p><a href="https://docs.qgis.org/3.16/de/docs/user_manual/appendices/qgis_file_formats.html">https://docs.qgis.org/3.16/de/docs/user_manual/appendices/qgis_file_formats.html</a> -><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Lato",sans-serif;color:#404040;background:#FCFCFC'>Die <strong><span style='font-family:"Lato",sans-serif'>QGD</span></strong>-Datei ist die zugehörige Sqlite-Datenbank des qgis-Projekts, die Hilfsdaten für das Projekt enthält. </span><o:p></o:p></p></blockquote><p class=MsoNormal><o:p> </o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><div><p class=MsoNormal>Für postgis schick in in den nächsten Tagen nochmal was. Wir haben das bei uns immer mit einem service definitions file gelöst.<o:p></o:p></p></div></div></blockquote><p><a href="https://wheregroup.com/blog/details/einfache-verbindung-von-postgresql-postgis-datenbanken-mit-qgis-mittels-mit-pg-serviceconf/">https://wheregroup.com/blog/details/einfache-verbindung-von-postgresql-postgis-datenbanken-mit-qgis-mittels-mit-pg-serviceconf/</a><o:p></o:p></p><p>Viele Grüße, Jörg<o:p></o:p></p><p>---------------------------------------------<br>Schon gewusst?<span style='font-family:"Tahoma",sans-serif'>
</span><br>In unserem Blog geben wir Tipps & Tricks zu Open-Source-GIS-Software <br>und berichten aus unserem Experten-Alltag:<br><a href="https://wheregroup.com/blog/">https://wheregroup.com/blog/</a><br>---------------------------------------------<br><br><br>Jörg Thomsen<br>WhereGroup GmbH<br>Bundesallee 23<br>10717 Berlin<br>Germany<br><br>Tel: +49 (0)30 / 5130 278 74<br>Fax: +49 (0)30 / 5130 278 11 <br><br><a href="mailto:joerg.thomsen@wheregroup.com">joerg.thomsen@wheregroup.com</a><br><a href="http://www.wheregroup.com">www.wheregroup.com</a><br><br>Geschäftsführer:<br>Olaf Knopp, Peter Stamm<br>Amtsgericht Bonn, HRB 9885<br><br>-------------------------------<br>Folgen Sie der WhereGroup auf twitter: <a href="http://twitter.com/WhereGroup_com">http://twitter.com/WhereGroup_com</a><o:p></o:p></p><p class=MsoNormal><span lang=FR-CH>-- <br>Lizmap-de mailing list<br></span><a href="mailto:Lizmap-de@lists.osgeo.org"><span lang=FR-CH>Lizmap-de@lists.osgeo.org</span></a><span lang=FR-CH><br></span><a href="https://lists.osgeo.org/mailman/listinfo/lizmap-de"><span lang=FR-CH>https://lists.osgeo.org/mailman/listinfo/lizmap-de</span></a><span lang=FR-CH><o:p></o:p></span></p></div></blockquote></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /><table style="border-top: 1px solid #D3D4DE;"><tr><td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"/></a></td><td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virenfrei.<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a></td></tr></table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body></html>