Skip to content

Commit 4cc2eb5

Browse files
authored
Merge pull request #50 from QGEP/docs_interlis
20171213 Docs interlis updated
2 parents 43a7535 + 1ab9597 commit 4cc2eb5

File tree

11 files changed

+409
-413
lines changed

11 files changed

+409
-413
lines changed

conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444

4545
# General information about the project.
4646
project = u'QGEP'
47-
copyright = u'2016, The QGEP Project/OPENGIS.ch'
47+
copyright = u'2018, The QGEP Project www.qgis.ch/en/projects/qgep-waste-water-module'
4848

4949
# The version info for the project you're documenting, acts as replacement for
5050
# |version| and |release|, also used in various other places throughout the
5151
# built documents.
5252
#
5353
# The short X.Y version.
54-
version = '0.5'
54+
version = '0.7'
5555
# The full version, including alpha/beta/rc tags.
56-
release = '0.5'
56+
release = '0.7'
5757

5858
# The language for content autogenerated by Sphinx. Refer to documentation
5959
# for a list of supported languages.

en/admin-guide/data-export/index.rst

+201-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,204 @@
1-
Data export
2-
===========
1+
Export INTERLIS Data
2+
====================
33

4-
This represents a guide on how to export data from QGEP.
4+
This represents a guide on how to export data from QGEP to INTERLIS 2 Transfer Format (xtf).
55

6-
Export formats
7-
------------------------------
86

9-
INTERLIS :ref:`_export-interlis`
10-
* dxf (in progress)
11-
* Shape
12-
* MOUSE / MikeUrban (please connect with the developer team if you are interested in this)
13-
* other
7+
General
8+
^^^^^^^^^^^^^
9+
10+
INTERLIS Export can be done using the ili2pg tool from Eisenhut Informatik and a series of prepared SQL scripts. They will do the following:
11+
12+
* Translation Englisch – German / French (Classes / Attributes)
13+
* Conversion of value list to / from numeric values (Integer)
14+
* Restructuring of data from relational to object oriented modelling
15+
* Conversion of OID (16 characters) to foreign keys TID (integer)
16+
17+
.. figure:: images/interlisexport.jpg
18+
19+
Step by step
20+
^^^^^^^^^^^^^
21+
22+
Tool
23+
--------
24+
Download the latest version of `ili2pg <http://eisenhutinformatik.ch/interlis/ili2pg>`_
25+
26+
.. figure:: images/eisenhut.jpg
27+
28+
Generate postgres ili2pg schema with data model
29+
-------------------------------------------------
30+
31+
a) Generate schema with data model
32+
You need the wanted INTERLIS model with all related models:
33+
34+
- *Units.ili*
35+
- *Base.ili*
36+
- *SIA405_Base.ili*
37+
- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations
38+
39+
>>> java -jar ili2pg.jar --createEnumTxtCol --schemaimport --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --dbdatabase qgep --dbschema vsa_dss_2015_2_d_391 --dbusr postgres --dbpwd sjib --log createschema_VSA_DSS_2015_2_d_391.log VSA_DSS_2015_2_d_20170602.ili
40+
41+
>>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping
42+
43+
44+
b) Generate schema with transferdata
45+
This example uses the Transferdataset transferdatensatz2015_d_mod.xtf and the VSA-DSS 2015 Modell file with all it's corresponding models.
46+
47+
We create a batch file for the import with ili2pg to create an ili2pg schema (named ``vsa_dss_2015_2_d``) in postgres *importdaten_VSA_DSS_2015_2_d_381.bat*
48+
49+
Adapt for your environment if necessary.
50+
51+
>>> java -jar ili2pg.jar --createEnumTxtCol --import --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --dbdatabase qgep --dbschema vsa_dss_2015_2_d --dbusr postgres --dbpwd sjib --log importdaten_VSA_DSS_2015_2_d_361.log transferdatensatz2015_d_mod.xtf
52+
53+
.. attention:: Very important to have these parameters:
54+
55+
>>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping
56+
57+
You need to have the necessary model files (ili) in the same folder as the xtf.
58+
59+
- *Units.ili*
60+
- *Base.ili*
61+
- *SIA405_Base.ili*
62+
- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations
63+
64+
(!! 29.5.2017 Beziehung Erhaltungsereignis.Ausfuehrende_Firma 0..* statt 0..1 (Fehlerkorrektur)
65+
!! 2.6.2017 Beziehung Abwasserknoten_Hydr_GeometrieAssocRef -- {0..*} statt 0..1 (Fehlerkorrektur))
66+
67+
68+
c) Create model tables in export schema with saved create query
69+
70+
- *00_vsa_dss_2015_2_d_304_schema_generate.sql* : create schema
71+
- *03_vsa_dss_2015_2_d_304_schema.sql* : create tables and metatables (version 2015)
72+
73+
Modify ili2pg schema and populate with metadata
74+
75+
- *042_vsa_dss_2015_2_d_304_insert_t_ili2db_attrname_metadata.sql*
76+
- *043_vsa_dss_2015_2_d_304_t_ili2db_attrname_add_column_owner_for_ili2pg301.sql* : Only needed if column does not exist yet (old ili2pg versions)
77+
78+
.. figure:: images/43.png
79+
80+
- *044_vsa_dss_2015_2_d_304_t_ili2db_classname_VSA_DSS_2015_2.sql* : insert VSA-DSS Model 2015 model classes
81+
82+
.. figure:: images/44.png
83+
84+
- *045_vsa_dss_2015_2_d_304_t_ili2db_model_VSA_DSS_2015_2.ili_metadata.sql* : insert VSA-DSS Model 2015 in metatable
85+
86+
87+
.. figure:: images/45.png
88+
89+
- *047_vsa_dss_2015_2_d_340_t_ili2db_inheritance_create.sql*
90+
- *048_vsa_dss_2015_2_d_340_t_ili2db_trafo_metadata.sql*
91+
92+
93+
94+
ili2pg schema explanation
95+
---------------------------
96+
97+
All three ways create the vsa_dss tables and all related model tables:
98+
99+
- **sia405_baseclass**
100+
- **sia405_symbolpos**
101+
- **sia405_textpos**
102+
103+
and some metatables for ili2pg:
104+
105+
- **t_ili2db_attrname**: iliname - sqlname
106+
- **t_ili2db_basket**
107+
- **t_ili2db_classname**: iliname - sqlname
108+
- **t_ili2db_dataset**
109+
- **t_ili2db_import**
110+
- **t_ili2db_import_basket**
111+
- **t_ili2db_import_object**
112+
- **t_ili2db_inheritance**
113+
- **t_ili2db_model** : bezeichnungen
114+
- **t_ili2db_settings**
115+
- **t_ili2_db_trafo**: new from ili2pg 3xx -> Daten abfüllen TO DO
116+
- **t_ili2_db_seq**: new from ili2pg 3xx -> fehlt in 03 – neu 021_erzeugen und Daten abfüllen TO DO
117+
- **t_key_object**: missing in script 03 -> create with 046 and add data
118+
119+
120+
121+
Add additional functions
122+
--------------------------------
123+
124+
We then need a series of function for the schema transformation form the created ili2pg schema to the qgep schema
125+
126+
- *01_vsa_dss_2015_2_d_304_tid_generate.sql* : Function to generate new tid in baseclass and sia405_baseclass when obj_id exists
127+
- *02_vsa_dss_2015_2_d_304_tid_lookup.sql* : Function to look up tid – used in 060
128+
- *021_vsa_dss_2015_2_d_304_create_seq_ili2db.sql* : only for old versions of ili2pg if not created with step above
129+
- *022_vsa_dss_2015_2_d_304_basket_update* : only for old versions of ili2pg if not created with step above
130+
131+
.. figure:: images/functions.png
132+
133+
- *046_vsa_dss_2015_2_d_304_t_key_object_insert_metadata.sql* to create t_key_object if table does not exist and add data.
134+
135+
.. figure:: images/46.png
136+
137+
138+
139+
Run the export queries for your datamodel
140+
----------------------------------------------
141+
142+
For VSA-DSS export
143+
144+
- *051_vsa_dss_2015_2_d_304_interlisexport2.sql* for VSA-DSS 2015 export
145+
- *kf_0511_geoAbwBW_li2cu.sql* : change from compoundcurve to linestring (ändert Geometrie type in export schema (curve))
146+
- *052a_vsa_dss_2015_2_d_304_interlisexport2.sql* : second part of data export
147+
148+
For SIA 405 Abwasser export
149+
150+
- *051_sia_2015_2_d_304_interlisexport2.sql* for SIA405 2015 export
151+
* etc.
152+
153+
But then the ili2pg schema needs to be created with SIA405 Abwasser model structure.
154+
155+
156+
Export data from ili2pg schema to INTERLIS
157+
---------------------------------------------
158+
159+
The following call exports the data into INTERLIS2 sia405abwasser (Version 2015)
160+
161+
>>> java -jar ili2pg.jar --trace --export --log export_sia405abwasser_2015_2_d.log --models SIA405_Abwasser_2015 --dbhost localhost --dbport 5432 --dbdatabase qgep --dbschema sia405abwasser --dbusr postgres --dbpwd yourpassword export.xtf
162+
163+
* --models <tag> sets the model name. The model files have to be in the same folder.
164+
* --log <tag> can be set as wanted – it makes sense to name it in a structured way *export_ & name of dataset_ & modellversion(ili name).log*
165+
* Adapt dbdatabase, dbschema, dbusr and dbpwd
166+
167+
This needs the following model files / Braucht folgende Modelldateien (licence for use neede from VSA or sia – you can get it by **purchasing** `Norm SIA405 <http://www.sia.ch/de/dienstleistungen/sia-norm/geodaten/>`_ or `VSA-DSS CD <https://www.vsa.ch/fachbereiche-cc/siedlungsentwaesserung/datenstruktur-siedlungsentwaesserung/interliscd/>`_):
168+
169+
- *units.ili*
170+
- *base.ili*
171+
- *sia405_base.ili*
172+
- *SIA405_Abwasser_2015_2_d.ili*
173+
174+
The following call exports the data into INTERLIS2 sia405abwasser (Version 2014)
175+
176+
>>> java -jar ili2pg.jar --trace --export --log export_sia405abwasser_2014_2_d.log --models SIA405_Abwasser --dbhost localhost --dbport 5432 --dbdatabase qgep --dbschema sia405abwasser --dbusr postgres --dbpwd yourpassword export.xtf
177+
178+
Needed models: *units.ili, base.ili, sia405_base.ili, SIA405_Abwasser_2014_2_d.ili*
179+
180+
181+
Quality controle with VSA online checker (Fachprüfung mit VSA Checker (online))
182+
-----------------------------------------------------------------------------------
183+
see https://www.vsa.ch/fachbereiche-cc/siedlungsentwaesserung/wegleitung-gep-daten/gep-datachecker/
184+
-> Link to login at infogrips.
185+
186+
187+
188+
Open issues
189+
---------------
190+
191+
* _text classe are not exported properly - no data in qgep
192+
* check if status is exported correctly
193+
194+
195+
Possible problems
196+
-------------------
197+
198+
* compoundcurve to linestring needed
199+
* 2D -> 3D coordinates (use ST_Force2D from postgis extension)
200+
201+
202+
203+
204+

0 commit comments

Comments
 (0)