GeoHelm/app/latest/qgis/pgservice.html

429 lines
20 KiB
HTML
Raw Normal View History

2024-01-27 19:04:46 +00:00
<!DOCTYPE html>
<html lang="en" >
<!-- Mirrored from geohelm.docs.acugis.com/en/latest/qgis/pgservice.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 13 Jul 2023 23:22:49 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pg_service.conf &mdash; AcuGIS GeoHelm 0.4.3 documentation</title>
<!-- AcuGIS 1 -->
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="../../../_/static/javascript/readthedocs-doc-embed.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Create a QGIS Project" href="qgis.html" />
<link rel="prev" title="Introduction" href="home.html" />
<!-- RTD Extra Head -->
<link rel="stylesheet" href="../../../_/static/css/readthedocs-doc-embed.css" type="text/css" />
<script type="application/json" id="READTHEDOCS_DATA">{"ad_free": false, "api_host": "https://readthedocs.org", "builder": "sphinx", "canonical_url": null, "docroot": "/docs/", "features": {"docsearch_disabled": false}, "global_analytics_code": "UA-17997319-1", "language": "en", "page": "qgis/pgservice", "programming_language": "perl", "project": "geohelm", "proxied_api_host": "/_", "source_suffix": ".rst", "subprojects": {}, "theme": "sphinx_rtd_theme", "user_analytics_code": "", "version": "latest"}</script>
<!--
Using this variable directly instead of using `JSON.parse` is deprecated.
The READTHEDOCS_DATA global variable will be removed in the future.
-->
<script type="text/javascript">
READTHEDOCS_DATA = JSON.parse(document.getElementById('READTHEDOCS_DATA').innerHTML);
</script>
<script type="text/javascript" src="../../../_/static/javascript/readthedocs-analytics.js" async="async"></script>
<!-- end RTD <extrahead> -->
</head>
<div id="header" style="position: fixed; height: 70px; padding-bottom: 20px; overflow: hidden; background-color: #28728d; display: block; z-index: 1000; width: 100%;">
<div class="acugis_geosuite" style="color:#fff!important; padding-left:30px; font-size:26px; padding-top: 20px;"><a href="https://geohelm.docs.acugis.com/" style="color:#fff!important; text-decoration:none!important">AcuGIS GeoHelm</a></div>
</div>
</div>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div id="header2"> </div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation" style="padding-top: 45px;">
<p class="caption"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro.html">Intro</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installing.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../layout.html">Layout</a></li>
<li class="toctree-l1"><a class="reference internal" href="../webmin.html">Control Panel</a></li>
<li class="toctree-l1"><a class="reference internal" href="../webmin.html#removing-the-control-panel">Removing the Control Panel</a></li>
</ul>
<p class="caption"><span class="caption-text">PostGIS</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../components/createdb/index.html">Create Database</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/postgresql/index.html">PostgreSQL</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/postgis/index.html">PostGIS</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/pgrouting/index.html">PgRouting</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/shp2pgsql/index.html">shp2pgsql</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/osm2pgsql/index.html">osm2pgsql</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/raster2pgsql/index.html">raster2pgsql</a></li>
</ul>
<p class="caption"><span class="caption-text">GeoServer</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/admin/index.html">Access</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/geoservers/index.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/tomcat/index.html">Apache Tomcat</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/workspace/index.html">Create a Workspace</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/store/index.html">Create Store</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/layer/index.html">Add Layer</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/shp/index.html">Load ESRI Shapefile</a></li>
<li class="toctree-l1"><a class="reference internal" href="../geoserver/styles/index.html">Styles</a></li>
</ul>
<p class="caption"><span class="caption-text">pg_tileserv</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../components/pgtileserv/index.html">pg_tileserv</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/pgfeatureserv/index.html">pg_featureserv</a></li>
</ul>
<p class="caption"><span class="caption-text">Database Operations</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../database/snapshot/index.html">Database Snapshots</a></li>
<li class="toctree-l1"><a class="reference internal" href="../database/clone/index.html">Clone Database</a></li>
<li class="toctree-l1"><a class="reference internal" href="../database/restore/index.html">Restore Database</a></li>
</ul>
<p class="caption"><span class="caption-text">QGIS</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="home.html">Introduction</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">pg_service.conf</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#why-use-it">Why Use It?</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-file-on-server">Create File on Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="#test-file-on-server">Test File on Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="#create-file-on-desktop">Create File on Desktop</a></li>
<li class="toctree-l2"><a class="reference internal" href="#register-file">Register File</a></li>
<li class="toctree-l2"><a class="reference internal" href="#test-file-on-desktop">Test File on Desktop</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="qgis.html">Create a QGIS Project</a></li>
<li class="toctree-l1"><a class="reference internal" href="publish.html">Publish Layers</a></li>
<li class="toctree-l1"><a class="reference internal" href="style-only.html">Publish Styles Only</a></li>
</ul>
<p class="caption"><span class="caption-text">LeafletJS</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../apps/choropleth.html">Leaflet Choropleth App</a></li>
<li class="toctree-l1"><a class="reference internal" href="../apps/geojson.html">Leaflet GeoJson</a></li>
<li class="toctree-l1"><a class="reference internal" href="../apps/php.html">Leaflet and PHP</a></li>
</ul>
<p class="caption"><span class="caption-text">Resources</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../resources/documents.html">Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/css.html">CSS</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/nagios.html">Nagios</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/support.html">Project Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/commercial.html">Commercial Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../resources/license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index-2.html">AcuGIS GeoHelm</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index-2.html" class="icon icon-home"></a> &raquo;</li>
<li>pg_service.conf</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/AcuGIS/GeoHelm/blob/master/docs/qgis/pgservice.rst" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="pg-service-conf">
<h1><a class="toc-backref" href="#id1">pg_service.conf</a><a class="headerlink" href="#pg-service-conf" title="Permalink to this headline"></a></h1>
<div class="contents topic" id="table-of-contents">
<p class="topic-title">Table of Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#pg-service-conf" id="id1">pg_service.conf</a><ul>
<li><a class="reference internal" href="#why-use-it" id="id2">Why Use It?</a></li>
<li><a class="reference internal" href="#create-file-on-server" id="id3">Create File on Server</a></li>
<li><a class="reference internal" href="#test-file-on-server" id="id4">Test File on Server</a></li>
<li><a class="reference internal" href="#create-file-on-desktop" id="id5">Create File on Desktop</a></li>
<li><a class="reference internal" href="#register-file" id="id6">Register File</a></li>
<li><a class="reference internal" href="#test-file-on-desktop" id="id7">Test File on Desktop</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="why-use-it">
<h2><a class="toc-backref" href="#id2">Why Use It?</a><a class="headerlink" href="#why-use-it" title="Permalink to this headline"></a></h2>
<p>The pg_service.conf file allows you to connect your QGIS project using only a Service Name, so your password is not stored (even in in encrypted format) in your QGIS document.</p>
<p>This is particulary important with QGIS as a misconfigured qgis_mapserver or Apache/NGINX can cause the .qgis file to be downloaded rather than rendered in the browser.</p>
</div>
<div class="section" id="create-file-on-server">
<h2><a class="toc-backref" href="#id3">Create File on Server</a><a class="headerlink" href="#create-file-on-server" title="Permalink to this headline"></a></h2>
<p><strong>1. Create the pg_service.conf file under the /etc/postgresql-common directory</strong></p>
<img alt="../_images/40-pg_service-1.png" src="../_images/40-pg_service-1.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>2. The contents of the file should be as below. Make sure to substitute your geouser password for the password show below</strong></p>
<img alt="../_images/40-pg_service-2.png" src="../_images/40-pg_service-2.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
</div>
<div class="section" id="test-file-on-server">
<h2><a class="toc-backref" href="#id4">Test File on Server</a><a class="headerlink" href="#test-file-on-server" title="Permalink to this headline"></a></h2>
<p>Its a good idea to test your file.</p>
<p>To do, su to user postgres:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">root</span><span class="nd">@suite</span><span class="p">:</span><span class="o">~</span><span class="c1"># su - postgres</span>
</pre></div>
</div>
<p>Issue psql service=geosuiteb:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>postgres@suite:~$ psql service=geosuitedb
psql (15.3 (Ubuntu 15.3-1.pgdg22.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)
Type &quot;help&quot; for help.
geodb=&gt;
</pre></div>
</div>
<p>You have now verified the pg_service.conf file is working correctly.</p>
</div>
<div class="section" id="create-file-on-desktop">
<h2><a class="toc-backref" href="#id5">Create File on Desktop</a><a class="headerlink" href="#create-file-on-desktop" title="Permalink to this headline"></a></h2>
<p><strong>1. Copy the pg_service.conf file you created above to your desktop and note the location</strong></p>
<p><strong>2. Change the host to the hostname (or IP) of your GeoSuite server</strong></p>
<p>So, for example, if your GeoSuite is running on IP 1.2.3.4, your file would look as below:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">geosuitedb</span><span class="p">]</span>
<span class="n">host</span><span class="o">=</span><span class="mf">1.2.3.4</span>
<span class="n">port</span><span class="o">=</span><span class="mi">5432</span>
<span class="n">dbname</span><span class="o">=</span><span class="n">geodb</span>
<span class="n">user</span><span class="o">=</span><span class="n">geouser</span>
<span class="n">password</span><span class="o">=</span><span class="n">Tristan1902</span>
</pre></div>
</div>
</div>
<div class="section" id="register-file">
<h2><a class="toc-backref" href="#id6">Register File</a><a class="headerlink" href="#register-file" title="Permalink to this headline"></a></h2>
<p>To registet the file, on Windows:</p>
<p><strong>1. Go to Control Panel and click on User Acccounts</strong></p>
<img alt="../_images/control-panel.png" src="../_images/control-panel.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>2. Click the User Acccounts link</strong></p>
<img alt="../_images/control-panel-2.png" src="../_images/control-panel-2.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>3. On the left menu, click “Change my environmental variables”</strong></p>
<img alt="../_images/control-panel-3.png" src="../_images/control-panel-3.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>4. In the Environmental Variables box click new. In the New User Variable box enter PGSERVICEFILE for Variable name and the location you saved the pg_service.conf file above as Variable value. Click OK</strong></p>
<img alt="../_images/control-panel-4.png" src="../_images/control-panel-4.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p>You have now registered your pg_service.conf file.</p>
</div>
<div class="section" id="test-file-on-desktop">
<h2><a class="toc-backref" href="#id7">Test File on Desktop</a><a class="headerlink" href="#test-file-on-desktop" title="Permalink to this headline"></a></h2>
<p>To test our pg_service.conf file on our desktop, start QGIS.</p>
<p><strong>1. On the left menu, click PostGIS and then right click “Add New Connection”</strong></p>
<img alt="../_images/30-qgis-2.png" src="../_images/30-qgis-2.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>2. In the Create New PostGIS Connection box, give your connection and name enter your service name</strong></p>
<img alt="../_images/30-qgis-0-2.png" src="../_images/30-qgis-0-2.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p><strong>3. Click the Test Connection button. You should see a success message at top as show below</strong></p>
<img alt="../_images/30-qgis-0-3.png" src="../_images/30-qgis-0-3.png" />
<img alt="../_images/spacer11.png" src="../_images/spacer11.png" />
<p>Congradualtions, you have successfully create a pg_service.conf file on your server and desktop</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="qgis.html" class="btn btn-neutral float-right" title="Create a QGIS Project" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="home.html" class="btn btn-neutral float-left" title="Introduction" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright acugis
<span class="commit">
Revision <code>db2a027e</code>.
</span>
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org/">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: latest
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Versions</dt>
<dd><a href="../index.html">latest</a></dd>
</dl>
<dl>
<dt>Downloads</dt>
<dd><a href="http://geohelm.docs.acugis.com/_/downloads/en/latest/pdf/">pdf</a></dd>
<dd><a href="http://geohelm.docs.acugis.com/_/downloads/en/latest/htmlzip/">html</a></dd>
<dd><a href="http://geohelm.docs.acugis.com/_/downloads/en/latest/epub/">epub</a></dd>
</dl>
<dl>
<dt>On Read the Docs</dt>
<dd>
<a href="http://readthedocs.org/projects/geohelm/?fromdocs=geohelm">Project Home</a>
</dd>
<dd>
<a href="http://readthedocs.org/builds/geohelm/?fromdocs=geohelm">Builds</a>
</dd>
</dl>
</div>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
<!-- Mirrored from geohelm.docs.acugis.com/en/latest/qgis/pgservice.html by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 13 Jul 2023 23:22:53 GMT -->
</html>