-
Notifications
You must be signed in to change notification settings - Fork 23
/
workstation.rst
221 lines (136 loc) · 7.49 KB
/
workstation.rst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
Setup workstation
=================
Database configuration
----------------------
To tell a workstation, where the database is (on the local system or on a
network server) you will have to create some files initially on every device on
which you will have QGIS/QGEP running (client). It is not required to do that on the
server itself.
These instructions depend on your operating system.
Windows pg_service
^^^^^^^^^^^^^^^^^^
Create a new directory where you want to store the configuration in. (E.g. a new folder ``pgconfig`` in your home folder). This directory will be referred to as ``PGSYSCONFDIR`` in this guide.
Set the environment variable ``PGSYSCONFDIR`` to the path to ``PGSYSCONFDIR``.
.. note:: Search for environment variable in your windows system settings, then click one of the following options, for either a user or a system variable:
Click ``New`` to add a new variable name and value.
Click an existing variable, and then click ``Edit`` to change its name or value.
Click an existing variable, and then click ``Delete`` to remove it.
.. figure:: images/umgebungsvariablen_pgconfdir.jpg
You can check your environment variables also within QGIS: Menu ``Settings`` --> ``Options...`` --> ``System`` Tab --> ``Environment``
Inside this folder, there will be two files
* ``pg_service.conf``
* ``pgpass`` (If you do not want to enter the password for the db every time)
.. attention::
On Windows, you need to save ``pg_service.conf`` in Unix format in order to work.
One way to do it is to open it with `Notepad++ <https://notepad-plus-plus.org/>`_
and ``Edit`` --> ``EOL Conversion`` --> ``UNIX Format`` --> ``File save`` .
.. _pg_service-linux:
Linux/macOS pg_service
^^^^^^^^^^^^^^^^^^^^^^
On Unix systems (linux/macOS etc.) you may put the files ``.pg_service.conf``
and ``.pgpass`` into your home folder (normally ``/home/[username]``). Pay attention to the starting . (<> Windows)!
If your QGIS doesn't find the ``.pg_service.conf`` file, set the environment variable PGSYSCONFDIR:
.. note::
In QGIS go to ``Settings`` > ``Options`` > ``System`` tab. Near the bottom you'll find ``Environment``. Tick ``Use custom variables`` and click on the plus on the right. Add the PGSYSCONFDIR variable using Append (to make sure you don't delete anything - doesn't matter probably) and its value (probably ``/home/[username]`` see above). Then click ``OK`` at the bottom right.
.. figure:: images/macEnvVarSet.png
After closing and reopening QGIS, you should be able to see the added PGSYSCONFDIR at the bottom of the same window under ``Current environment variables``.
.. figure:: images/macEnvVarCheck.png
All systems
^^^^^^^^^^^
Put the following content in the file ``pg_service.conf`` or ``.pg_service.conf``.
You may have to adapt the variables for your setup.
.. code:: ini
[pg_qgep]
host=localhost
port=5432
dbname=qgep
user=qgepuser
To save the password as well on the system you may use the file `pgpass <http://www.postgresql.org/docs/current/static/libpq-pgpass.html>`_.
.. code:: ini
localhost:5432:*:qgepuser:password
.. note:: If you don't have the database on your local machine replace any
occurence of ``localhost`` with the network address of your database
server.
Alternative: put your password directly into the ``pg_service.conf`` (on Windows) / ``.pg_service.conf`` (on *nix) file:
.. code:: ini
[pg_qgep]
host=localhost
port=5432
dbname=qgep
user=qgepuser
password=***
Install QGIS
------------
* Minimum requirement 3.4
* We recommend using the latest master build (called qgis-dev on Windows)
which often offers a better experience in combination with QGEP.
For Windows installation, download the `OSGeo4W Installer <http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe>`_
choose *advanced installation* and install qgis-dev.
Install QGEP plugin
-------------------
Plugin requirements:
- `networkx <https://pypi.org/project/networkx/>`_ >= 2.1
You can install them on Debian based systems with::
sudo pip install networkx
sudo apt-get install libqt4-sql-psql
Or for Windows users, directly in QGIS via the Python Console with::
import pip; pip.main(["install", "networkx"])
* Open QGIS
* Go to ``Plugins``
* ``Manage and Install Plugins``
* ``Settings``
* Enable ``Show also experimental plugins``
* Activate the plugin (see image below):
* All
* Search `QGEP`
* Click the checkbox next to it
.. figure:: images/001_searchplugin.jpeg
**Add the QGEP plugin**
Optional plugin
~~~~~~~~~~~~~~~
QGEP uses a data historization process. The ``pg history viewer`` `plugin <http://plugins.qgis.org/plugins/pg_history_viewer/>`_ allows you to view the changes made and replay some of them.
Install the demo data
---------------------
as described `here <https://qgep.github.io/docs/installation-guide/database-initialization.html#restore-demo-datamodel>`_
Install the demo project
------------------------
* Download from https://github.com/QGEP/qgep/releases/latest the qgep.zip
* Extract the file
* If you leave the qgep_[language].qm files in the same directory as the qgep.qgs file and start QGIS with one of these languages, your qgep-project will be translated to that langue when you start the project. E.g. you start qgep.qgs with a QGIS Installation that is set to German, then the qgep.qgs project will appear in German.
.. note:: You need to explicitly set the language in QGIS in settings. If QGIS is configured to take the system language, the QGEP translation is not loaded.
.. figure:: images/qgep_project_qm_language_files.jpg
* Open `project/qgep.qgs` with QGIS
* When you save that project it will keep it's language and it cannot be changed in the same way.
If you are a data owner: Add your own OID to the project
--------------------------------------------------------
* If you are a data owner (Datenherr), you should add your OID data in the table qgep_sys.oid_prefixes:
.. figure:: images/oid_prefix.jpg
* Edit ``02_oid_generation.sql`` with your OID if you want it permanently in the QGEP project and hand in a pull request
https://github.com/QGEP/datamodel/blob/master/02_oid_generation.sql
.. code:: sql
-- sample entry for the City of Uster - you need to add an entry for your own organization
INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch11h8mw','Stadt Uster',TRUE);
INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch15z36d','SIGE',FALSE);
INSERT INTO qgep_sys.oid_prefixes (prefix,organization,active) VALUES ('ch13p7mz','Arbon',FALSE);
and set the OID you want to use in your project to TRUE.
* or add it locally to your project with an INSERT statement.
* OID prefixes have to be ordered at https://www.interlis.ch/en/dienste/oid-bestellen
.. note:: If you work with different databases for different communities, you should use different OID prefixes for each database.
Working with more than one database
-----------------------------------
* Create a new database in pgAdmin with a new name, e.g. communityA
* Create a new schema qgep in this database (do not choose another name, because all scripts works with the schema-name qgep)
* Go further on as described in 1.2 Database initialization
* Change the ``pg_service.conf`` - file
.. code:: ini
[pg_qgep]
host=localhost
port=5432
dbname=qgep
user=qgepuser
[pg_communityA]
host=localhost
port=5432
dbname=communityA
user=qgepuser
* Search and replace in the copy of ``qgep_en.qgs`` all 'pg_qgep' with 'pg_communityA'