diff --git a/conf.py b/conf.py index ca4559806..1b0a89837 100644 --- a/conf.py +++ b/conf.py @@ -44,16 +44,16 @@ # General information about the project. project = u'QGEP' -copyright = u'2016, The QGEP Project/OPENGIS.ch' +copyright = u'2018, The QGEP Project www.qgis.ch/en/projects/qgep-waste-water-module' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.5' +version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.5' +release = '0.7' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/en/admin-guide/data-export/index.rst b/en/admin-guide/data-export/index.rst index fb923d4fc..4a6ebc975 100644 --- a/en/admin-guide/data-export/index.rst +++ b/en/admin-guide/data-export/index.rst @@ -1,13 +1,204 @@ -Data export -=========== +Export INTERLIS Data +==================== -This represents a guide on how to export data from QGEP. +This represents a guide on how to export data from QGEP to INTERLIS 2 Transfer Format (xtf). -Export formats ------------------------------- -INTERLIS :ref:`_export-interlis` -* dxf (in progress) -* Shape -* MOUSE / MikeUrban (please connect with the developer team if you are interested in this) -* other +General +^^^^^^^^^^^^^ + +INTERLIS Export can be done using the ili2pg tool from Eisenhut Informatik and a series of prepared SQL scripts. They will do the following: + +* Translation Englisch – German / French (Classes / Attributes) +* Conversion of value list to / from numeric values (Integer) +* Restructuring of data from relational to object oriented modelling +* Conversion of OID (16 characters) to foreign keys TID (integer) + + .. figure:: images/interlisexport.jpg + +Step by step +^^^^^^^^^^^^^ + +Tool +-------- +Download the latest version of `ili2pg `_ + + .. figure:: images/eisenhut.jpg + +Generate postgres ili2pg schema with data model +------------------------------------------------- + +a) Generate schema with data model +You need the wanted INTERLIS model with all related models: + +- *Units.ili* +- *Base.ili* +- *SIA405_Base.ili* +- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations + +>>> 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 + +>>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping + + +b) Generate schema with transferdata +This example uses the Transferdataset transferdatensatz2015_d_mod.xtf and the VSA-DSS 2015 Modell file with all it's corresponding models. + +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* + +Adapt for your environment if necessary. + +>>> 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 + +.. attention:: Very important to have these parameters: + +>>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping + +You need to have the necessary model files (ili) in the same folder as the xtf. + +- *Units.ili* +- *Base.ili* +- *SIA405_Base.ili* +- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations + +(!! 29.5.2017 Beziehung Erhaltungsereignis.Ausfuehrende_Firma 0..* statt 0..1 (Fehlerkorrektur) +!! 2.6.2017 Beziehung Abwasserknoten_Hydr_GeometrieAssocRef -- {0..*} statt 0..1 (Fehlerkorrektur)) + + +c) Create model tables in export schema with saved create query + +- *00_vsa_dss_2015_2_d_304_schema_generate.sql* : create schema +- *03_vsa_dss_2015_2_d_304_schema.sql* : create tables and metatables (version 2015) + +Modify ili2pg schema and populate with metadata + +- *042_vsa_dss_2015_2_d_304_insert_t_ili2db_attrname_metadata.sql* +- *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) + + .. figure:: images/43.png + +- *044_vsa_dss_2015_2_d_304_t_ili2db_classname_VSA_DSS_2015_2.sql* : insert VSA-DSS Model 2015 model classes + + .. figure:: images/44.png + +- *045_vsa_dss_2015_2_d_304_t_ili2db_model_VSA_DSS_2015_2.ili_metadata.sql* : insert VSA-DSS Model 2015 in metatable + + + .. figure:: images/45.png + +- *047_vsa_dss_2015_2_d_340_t_ili2db_inheritance_create.sql* +- *048_vsa_dss_2015_2_d_340_t_ili2db_trafo_metadata.sql* + + + +ili2pg schema explanation +--------------------------- + +All three ways create the vsa_dss tables and all related model tables: + +- **sia405_baseclass** +- **sia405_symbolpos** +- **sia405_textpos** + +and some metatables for ili2pg: + +- **t_ili2db_attrname**: iliname - sqlname +- **t_ili2db_basket** +- **t_ili2db_classname**: iliname - sqlname +- **t_ili2db_dataset** +- **t_ili2db_import** +- **t_ili2db_import_basket** +- **t_ili2db_import_object** +- **t_ili2db_inheritance** +- **t_ili2db_model** : bezeichnungen +- **t_ili2db_settings** +- **t_ili2_db_trafo**: new from ili2pg 3xx -> Daten abfüllen TO DO +- **t_ili2_db_seq**: new from ili2pg 3xx -> fehlt in 03 – neu 021_erzeugen und Daten abfüllen TO DO +- **t_key_object**: missing in script 03 -> create with 046 and add data + + + +Add additional functions +-------------------------------- + +We then need a series of function for the schema transformation form the created ili2pg schema to the qgep schema + +- *01_vsa_dss_2015_2_d_304_tid_generate.sql* : Function to generate new tid in baseclass and sia405_baseclass when obj_id exists +- *02_vsa_dss_2015_2_d_304_tid_lookup.sql* : Function to look up tid – used in 060 +- *021_vsa_dss_2015_2_d_304_create_seq_ili2db.sql* : only for old versions of ili2pg if not created with step above +- *022_vsa_dss_2015_2_d_304_basket_update* : only for old versions of ili2pg if not created with step above + + .. figure:: images/functions.png + +- *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. + + .. figure:: images/46.png + + + +Run the export queries for your datamodel +---------------------------------------------- + +For VSA-DSS export + +- *051_vsa_dss_2015_2_d_304_interlisexport2.sql* for VSA-DSS 2015 export +- *kf_0511_geoAbwBW_li2cu.sql* : change from compoundcurve to linestring (ändert Geometrie type in export schema (curve)) +- *052a_vsa_dss_2015_2_d_304_interlisexport2.sql* : second part of data export + +For SIA 405 Abwasser export + +- *051_sia_2015_2_d_304_interlisexport2.sql* for SIA405 2015 export +* etc. + +But then the ili2pg schema needs to be created with SIA405 Abwasser model structure. + + +Export data from ili2pg schema to INTERLIS +--------------------------------------------- + +The following call exports the data into INTERLIS2 sia405abwasser (Version 2015) + +>>> 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 + +* --models sets the model name. The model files have to be in the same folder. +* --log can be set as wanted – it makes sense to name it in a structured way *export_ & name of dataset_ & modellversion(ili name).log* +* Adapt dbdatabase, dbschema, dbusr and dbpwd + +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 `_ or `VSA-DSS CD `_): + +- *units.ili* +- *base.ili* +- *sia405_base.ili* +- *SIA405_Abwasser_2015_2_d.ili* + +The following call exports the data into INTERLIS2 sia405abwasser (Version 2014) + +>>> 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 + +Needed models: *units.ili, base.ili, sia405_base.ili, SIA405_Abwasser_2014_2_d.ili* + + +Quality controle with VSA online checker (Fachprüfung mit VSA Checker (online)) +----------------------------------------------------------------------------------- +see https://www.vsa.ch/fachbereiche-cc/siedlungsentwaesserung/wegleitung-gep-daten/gep-datachecker/ +-> Link to login at infogrips. + + + +Open issues +--------------- + +* _text classe are not exported properly - no data in qgep +* check if status is exported correctly + + +Possible problems +------------------- + +* compoundcurve to linestring needed +* 2D -> 3D coordinates (use ST_Force2D from postgis extension) + + + + + diff --git a/en/admin-guide/data-export/interlisexport.rst b/en/admin-guide/data-export/interlisexport.rst deleted file mode 100644 index 080bfa3b0..000000000 --- a/en/admin-guide/data-export/interlisexport.rst +++ /dev/null @@ -1,203 +0,0 @@ -.. _export-interlis: - -Export INTERLIS Data -==================== - -This represents a guide on how to export data from QGEP to INTERLIS 2 Transfer Format (xtf). - - -General -^^^^^^^^^^^^^ - -INTERLIS Export can be done using the ili2pg tool from Eisenhut Informatik and a series of prepared SQL scripts. They will do the following: -* Translation Englisch – German / French (Classes / Attributes) -* Conversion of value list to / from numeric values (Integer) -* Restructuring of data from relational to object oriented modelling -* Conversion of OID (16 characters) to foreign keys TID (integer) - - .. figure:: images/interlisexport.jpg - -Step by step -^^^^^^^^^^^^^ - -Tool --------- -Download the latest version of `ili2pg `_ - - .. figure:: images/eisenhut.jpg - -Generate postgres ili2pg schema with data model -------------------------------------------------- - -a) Generate schema with data model -You need the wanted INTERLIS model with all related models: - -- *Units.ili* -- *Base.ili* -- *SIA405_Base.ili* -- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations - ->>> 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 - ->>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping - - -b) Generate schema with transferdata -This example uses the Transferdataset transferdatensatz2015_d_mod.xtf and the VSA-DSS 2015 Modell file with all it's corresponding models. - -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* - -Adapt for your environment if necessary. - ->>> 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 - -.. attention:: Very important to have these parameters: - ->>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping - -You need to have the necessary model files (ili) in the same folder as the xtf. - -- *Units.ili* -- *Base.ili* -- *SIA405_Base.ili* -- *VSA_DSS_2015_2_d_20170602.ili* for Version 2015 –> corrected version relations - -(!! 29.5.2017 Beziehung Erhaltungsereignis.Ausfuehrende_Firma 0..* statt 0..1 (Fehlerkorrektur) -!! 2.6.2017 Beziehung Abwasserknoten_Hydr_GeometrieAssocRef -- {0..*} statt 0..1 (Fehlerkorrektur)) - - -c) Create model tables in export schema with saved create query - -- *00_vsa_dss_2015_2_d_304_schema_generate.sql* : create schema -- *03_vsa_dss_2015_2_d_304_schema.sql* : create tables and metatables (version 2015) - -Modify ili2pg schema and populate with metadata - -- *042_vsa_dss_2015_2_d_304_insert_t_ili2db_attrname_metadata.sql* -- *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) - - .. figure:: images/43.png - -- *044_vsa_dss_2015_2_d_304_t_ili2db_classname_VSA_DSS_2015_2.sql* : insert VSA-DSS Model 2015 model classes - - .. figure:: images/44.png - -- *045_vsa_dss_2015_2_d_304_t_ili2db_model_VSA_DSS_2015_2.ili_metadata.sql* : insert VSA-DSS Model 2015 in metatable - - - .. figure:: images/45.png - -- *047_vsa_dss_2015_2_d_340_t_ili2db_inheritance_create.sql* -- *048_vsa_dss_2015_2_d_340_t_ili2db_trafo_metadata.sql* - - - -ili2pg schema explanation ---------------------------- - -All three ways create the vsa_dss tables and all related model tables: - -- **sia405_baseclass** -- **sia405_symbolpos** -- **sia405_textpos** - -and some metatables for ili2pg: - -- **t_ili2db_attrname**: iliname - sqlname -- **t_ili2db_basket** -- **t_ili2db_classname**: iliname - sqlname -- **t_ili2db_dataset** -- **t_ili2db_import** -- **t_ili2db_import_basket** -- **t_ili2db_import_object** -- **t_ili2db_inheritance** -- **t_ili2db_model** : bezeichnungen -- **t_ili2db_settings** -- **t_ili2_db_trafo**: new from ili2pg 3xx -> Daten abfüllen TO DO -- **t_ili2_db_seq**: new from ili2pg 3xx -> fehlt in 03 – neu 021_erzeugen und Daten abfüllen TO DO -- **t_key_object**: missing in script 03 -> create with 046 and add data - - - -Add additional functions --------------------------------- - -We then need a series of function for the schema transformation form the created ili2pg schema to the qgep schema - -- *01_vsa_dss_2015_2_d_304_tid_generate.sql* : Function to generate new tid in baseclass and sia405_baseclass when obj_id exists -- *02_vsa_dss_2015_2_d_304_tid_lookup.sql* : Function to look up tid – used in 060 -- *021_vsa_dss_2015_2_d_304_create_seq_ili2db.sql* : only for old versions of ili2pg if not created with step above -- *022_vsa_dss_2015_2_d_304_basket_update* : only for old versions of ili2pg if not created with step above - - .. figure:: images/functions.png - -- *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. - - .. figure:: images/46.png - - - -Run the export queries for your datamodel ----------------------------------------------- - -For VSA-DSS export - -- *051_vsa_dss_2015_2_d_304_interlisexport2.sql* for VSA-DSS 2015 export -- *kf_0511_geoAbwBW_li2cu.sql* : change from compoundcurve to linestring (ändert Geometrie type in export schema (curve)) -- *052a_vsa_dss_2015_2_d_304_interlisexport2.sql* : second part of data export - -For SIA 405 Abwasser export - -- *051_sia_2015_2_d_304_interlisexport2.sql* for SIA405 2015 export -* etc. - -But then the ili2pg schema needs to be created with SIA405 Abwasser model structure. - - -Export data from ili2pg schema to INTERLIS ---------------------------------------------- - -The following call exports the data into INTERLIS2 sia405abwasser (Version 2015) - ->>> 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 - -* --models sets the model name. The model files have to be in the same folder. -* --log can be set as wanted – it makes sense to name it in a structured way *export_ & name of dataset_ & modellversion(ili name).log* -* Adapt dbdatabase, dbschema, dbusr and dbpwd - -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 `_ or `VSA-DSS CD `_): - -- *units.ili* -- *base.ili* -- *sia405_base.ili* -- *SIA405_Abwasser_2015_2_d.ili* - -The following call exports the data into INTERLIS2 sia405abwasser (Version 2014) - ->>> 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 - -Needed models: *units.ili, base.ili, sia405_base.ili, SIA405_Abwasser_2014_2_d.ili* - - -Quality controle with VSA online checker (Fachprüfung mit VSA Checker (online)) ------------------------------------------------------------------------------------ -see https://www.vsa.ch/fachbereiche-cc/siedlungsentwaesserung/wegleitung-gep-daten/gep-datachecker/ --> Link to login at infogrips. - - - -Open issues ---------------- -* _text classe are not exported properly - no data in qgep -* check if status is exported correctly - - -Possible problems -------------------- -* compoundcurve to linestring needed -* 2D -> 3D coordinates (use ST_Force2D from postgis extension) - - - - - diff --git a/en/admin-guide/data-import/index.rst b/en/admin-guide/data-import/index.rst index 5d33f2e5b..d84065a1b 100644 --- a/en/admin-guide/data-import/index.rst +++ b/en/admin-guide/data-import/index.rst @@ -1,14 +1,178 @@ -Data import -=========== +Import INTERLIS Data +==================== -This represents a guide on how to import data to QGEP. +This represents a guide on how to import data to QGEP from INTERLIS 2 Transfer Format (xtf). -Import formats ------------------------------- -* INTERLIS :ref:`_import-interlis` +General +^^^^^^^^^^^^^ + +INTERLIS Import can be done using the ili2pg tool from Eisenhut Informatik and a series of prepared SQL scripts. They will do the following: + +* Translation Englisch – German / French (Classes / Attributes) +* Conversion of value list to / from numeric values (Integer) +* Restructuring of data from relational to object oriented modelling +* Conversion of foreign keys TID (integer) to OID (16 characters) again + + .. figure:: images/interlisimport.jpg + +Step by step +^^^^^^^^^^^^^ + +Tool +-------- +Download the latest version of `ili2pg `_ + + .. figure:: images/eisenhut.jpg + +Generate ili2pg schema with data model +-------------------------------------- + +You need a valid INTERLIS 2 Transferdataset, the corresponding INTERLIS model + +This example uses the Transferdataset transferdatensatz2015_d_mod.xtf and the VSA-DSS 2015 Modell file with all it's corresponding models. + +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*. + +Adapt for your environment if necessary. + +``` +:: + +>>> 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 +``` + +.. attention:: Very important to have these parameters: + +>>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping + +You need to have the necessary model files (ili) in the same folder as the xtf. + +- *Units.ili* +- *Base.ili* +- *SIA405_Base.ili* +- *VSA_DSS_2015_2_d_20170602.ili* (for Version 2015) –> corrected version relations + +(!! 29.5.2017 Beziehung Erhaltungsereignis.Ausfuehrende_Firma 0..* statt 0..1 (Fehlerkorrektur) +!! 2.6.2017 Beziehung Abwasserknoten_Hydr_GeometrieAssocRef -- {0..*} statt 0..1 (Fehlerkorrektur)) + +.. Note:: If the INTERLIS model is German, then the ili2pg schema will have German table names. If the model is French, then the will be in French. + + +Add additional functions +------------------------ + +We then need a series of function for the schema transformation form the created ili2pg schema to the ``qgep`` schema + +- *01_vsa_dss_2015_2_d_304_tid_generate.sql* : Function to generate new tid in baseclass and sia405_baseclass when obj_id exists +- *02_vsa_dss_2015_2_d_304_tid_lookup.sql* : Function to look up tid – used in 060 +- *-02_vsa_dss_2015_2_d_304_objid_lookup.sql: Function to look up obj_id – also used in 060 +- *046_vsa_dss_2015_2_d_304_t_key_object_insert_metadata.sql* to create t_key_object if table does not exist. + + .. figure:: images/functions.png + +Add additional view +----------------------- + +This view is needed for the import queries and has to be added to the ili2pg schema beforehand + +- *050_vsa_dss_2015_2_d_304_import_vw_sia405_baseclass_metattribute.sql* + +Add two other functions +------------------------ + +- *053_create_key_object_seq.sql* : key_objects_seq function copies the latest seq value into table t_key_object +- *054_create_function_meta_organisation.sql* : This creates the function meta_organisation. This function allows to generate a new dataset in table organisation and all related needed metatables (baseclass, sia405_baseclass etc.) with an obj_id you specify + +Modify Metadata and Organisation data +------------------------------------- + +- *055_select meta_organisation_bezeichnung_obj_id.sql* + +Run this function before importing data from ili2pg to qgep schema, else you will have problems importing fk_dataowner / fk_provider fields if they are not with a valid obj_id but some form of identifier (e.g. with the Transferdatensatz_VSA_DSS.xtf) + + .. figure:: images/set_key_object_seq.png + +Set t_key_object to latest sequence of project so that tid (integer) is correct: + +>>> SELECT vsa_dss_2015_2_d_304.key_object_seq; + +Set all the matching definitions for missing dataowner (datenherr) / provider (datenlieferant) organisations in table **organisation** + +>>> SELECT vsa_dss_2015_2_d.meta_organisation('VSA', 'ch080qwzOG000098'); +>>> SELECT vsa_dss_2015_2_d.meta_organisation('SBU', 'ch080qwzOG000099'); + +Add your own or modify if needed. + +This generates data in table **organization (privat)** for existing additional dataproviders and dataowners (metadata) with the new function meta_organisation +select meta_organisation_bezeichnung_obj_id.sql as template: + +>>> SELECT vsa_dss_2015_2_d_304.meta_organisation('VSA', 'ch080qwzOG000098'); + +You have to select the identifier of existing dataowners e.g. VSA and define a relating OBJ_ID for it e.g. 'ch080qwzOG000098 + +If you test this with the transferdataset from VSA replace also SBU: + +>>> SELECT vsa_dss_2015_2_d_304.meta_organisation('SBU', 'ch080qwzOG000099'); + + +Run the import queries for your datamodel +---------------------------------------------- + +- *060_sia405_interlisimport.sql* for SIA405 2015 import +- *060_dss_interlisimport.sql* for VSA-DSS 2015 Import +- *060_dss_2008_xxx.sql* for Version 2008 + + + +Create a batch job +------------------- + +You can also run all the SQL queries in one batch job, here an example: + +>>> rem bat and sql in the same directory +set PATH=%PATH%;C:\Program Files\PostgreSQL\9.4\bin +psql -U postgres -d vsa_dss_2015_2_d_304 -f 01_vsa_dss_2015_2_d_304_tid_generate.sql +psql -U postgres -d vsa_dss_2015_2_d_304 -f 02_vsa_dss_2015_2_d_304_tid_lookup.sql +pause + +Specify the path variable to postgresSQL on your system + +``-U`` sets the user +``-d`` sets the dbname +``-f`` sets the filenam + +For more details see https://www.postgresql.org/docs/9.2/static/app-psql.html + + +Open issues +--------------- + +* More than one Text class per element not supported yet – needs CASE WHEN for vali / hali (to do if needed) + + .. figure:: images/textref.jpg + + * If data is exported from DABASE or other systems it may be that the **reach**.trace has double point or that is going from **wastewater_node** to **wastewater_node** instead of **reach_point** to **reach_point**. Looking for a solution to automatically check after import and "clean" linestring. + + + +Possible problems +------------------- + +* qgep schema of demodata has missing foreignkeys: Einleitstelle.fs_Gewaessersektor, Versickerungsanlage.fs_Grundwasserleiter, Abwasserknoten.fs_hydrgeomref –> check whether ok in empty schema ``qgep``. + +* Need to use ``ST_Force3D`` for geometries – because qgep model is with 3D coordinates + +* If identifier in table is not unique there will be an error on the import of the table: + +>>> FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint „in_od_wastewater_structure_identifier“ +DETAIL: Schlüssel „(identifier, fk_dataowner)=(V1.100, ch080qwzOG000098)“ existiert bereits. +********** Error ********** +FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint „in_od_wastewater_structure_identifier“ +SQL state: 23505 +Detail: Schlüssel „(identifier, fk_dataowner)=(V1.100, ch080qwzOG000098)“ existiert bereits. + +* Change identifier V1.100 to V1.100.2 in class **abwasserbauwerk** for Transferdatensatz VSA 2015 to avoid conflict in qgep schema having the same combination identifier / fk_dataowner. + + .. figure:: images/unique_identifier_dataowner.jpg -* dxf (in progress) -* Shape -* MOUSE / MikeUrban (please connect with the developer team if you are interested in this) -* other diff --git a/en/admin-guide/data-import/interlisimport.rst b/en/admin-guide/data-import/interlisimport.rst deleted file mode 100644 index 47006bf77..000000000 --- a/en/admin-guide/data-import/interlisimport.rst +++ /dev/null @@ -1,180 +0,0 @@ -.. _import-interlis: - -Import INTERLIS Data -==================== - -This represents a guide on how to import data to QGEP from INTERLIS 2 Transfer Format (xtf). - - -General -^^^^^^^^^^^^^ - -INTERLIS Import can be done using the ili2pg tool from Eisenhut Informatik and a series of prepared SQL scripts. They will do the following: - -* Translation Englisch – German / French (Classes / Attributes) -* Conversion of value list to / from numeric values (Integer) -* Restructuring of data from relational to object oriented modelling -* Conversion of foreign keys TID (integer) to OID (16 characters) again - - .. figure:: images/interlisimport.jpg - -Step by step -^^^^^^^^^^^^^ - -Tool --------- -Download the latest version of `ili2pg `_ - - .. figure:: images/eisenhut.jpg - -Generate ili2pg schema with data model --------------------------------------- - -You need a valid INTERLIS 2 Transferdataset, the corresponding INTERLIS model - -This example uses the Transferdataset transferdatensatz2015_d_mod.xtf and the VSA-DSS 2015 Modell file with all it's corresponding models. - -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*. - -Adapt for your environment if necessary. - -``` -:: - ->>> 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 -``` - -.. attention:: Very important to have these parameters: - ->>> --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping - -You need to have the necessary model files (ili) in the same folder as the xtf. - -- *Units.ili* -- *Base.ili* -- *SIA405_Base.ili* -- *VSA_DSS_2015_2_d_20170602.ili* (for Version 2015) –> corrected version relations - -(!! 29.5.2017 Beziehung Erhaltungsereignis.Ausfuehrende_Firma 0..* statt 0..1 (Fehlerkorrektur) -!! 2.6.2017 Beziehung Abwasserknoten_Hydr_GeometrieAssocRef -- {0..*} statt 0..1 (Fehlerkorrektur)) - -.. Note:: If the INTERLIS model is German, then the ili2pg schema will have German table names. If the model is French, then the will be in French. - - -Add additional functions ------------------------- - -We then need a series of function for the schema transformation form the created ili2pg schema to the ``qgep`` schema - -- *01_vsa_dss_2015_2_d_304_tid_generate.sql* : Function to generate new tid in baseclass and sia405_baseclass when obj_id exists -- *02_vsa_dss_2015_2_d_304_tid_lookup.sql* : Function to look up tid – used in 060 -- *-02_vsa_dss_2015_2_d_304_objid_lookup.sql: Function to look up obj_id – also used in 060 -- *046_vsa_dss_2015_2_d_304_t_key_object_insert_metadata.sql* to create t_key_object if table does not exist. - - .. figure:: images/functions.png - -Add additional view ------------------------ - -This view is needed for the import queries and has to be added to the ili2pg schema beforehand - -- *050_vsa_dss_2015_2_d_304_import_vw_sia405_baseclass_metattribute.sql* - -Add two other functions ------------------------- - -- *053_create_key_object_seq.sql* : key_objects_seq function copies the latest seq value into table t_key_object -- *054_create_function_meta_organisation.sql* : This creates the function meta_organisation. This function allows to generate a new dataset in table organisation and all related needed metatables (baseclass, sia405_baseclass etc.) with an obj_id you specify - -Modify Metadata and Organisation data -------------------------------------- - -- *055_select meta_organisation_bezeichnung_obj_id.sql* - -Run this function before importing data from ili2pg to qgep schema, else you will have problems importing fk_dataowner / fk_provider fields if they are not with a valid obj_id but some form of identifier (e.g. with the Transferdatensatz_VSA_DSS.xtf) - - .. figure:: images/set_key_object_seq.png - -Set t_key_object to latest sequence of project so that tid (integer) is correct: - ->>> SELECT vsa_dss_2015_2_d_304.key_object_seq; - -Set all the matching definitions for missing dataowner (datenherr) / provider (datenlieferant) organisations in table **organisation** - ->>> SELECT vsa_dss_2015_2_d.meta_organisation('VSA', 'ch080qwzOG000098'); ->>> SELECT vsa_dss_2015_2_d.meta_organisation('SBU', 'ch080qwzOG000099'); - -Add your own or modify if needed. - -This generates data in table **organization (privat)** for existing additional dataproviders and dataowners (metadata) with the new function meta_organisation -select meta_organisation_bezeichnung_obj_id.sql as template: - ->>> SELECT vsa_dss_2015_2_d_304.meta_organisation('VSA', 'ch080qwzOG000098'); - -You have to select the identifier of existing dataowners e.g. VSA and define a relating OBJ_ID for it e.g. 'ch080qwzOG000098 - -If you test this with the transferdataset from VSA replace also SBU: - ->>> SELECT vsa_dss_2015_2_d_304.meta_organisation('SBU', 'ch080qwzOG000099'); - - -Run the import queries for your datamodel ----------------------------------------------- - -- *060_sia405_interlisimport.sql* for SIA405 2015 import -- *060_dss_interlisimport.sql* for VSA-DSS 2015 Import -- *060_dss_2008_xxx.sql* for Version 2008 - - - -Create a batch job -------------------- - -You can also run all the SQL queries in one batch job, here an example: - ->>> rem bat and sql in the same directory -set PATH=%PATH%;C:\Program Files\PostgreSQL\9.4\bin -psql -U postgres -d vsa_dss_2015_2_d_304 -f 01_vsa_dss_2015_2_d_304_tid_generate.sql -psql -U postgres -d vsa_dss_2015_2_d_304 -f 02_vsa_dss_2015_2_d_304_tid_lookup.sql -pause - -Specify the path variable to postgresSQL on your system - -``-u`` sets the user -``-d`` sets the dbname -``-f`` sets the filenam - -For more details see https://www.postgresql.org/docs/9.2/static/app-psql.html - - -Open issues ---------------- - -* More than one Text class per element not supported yet – needs CASE WHEN for vali / hali (to do if needed) - - .. figure:: images/textref.jpg - - * If data is exported from DABASE or other systems it may be that the **reach**.trace has double point or that is going from **wastewater_node** to **wastewater_node** instead of **reach_point** to **reach_point**. Looking for a solution to automatically check after import and "clean" linestring. - - - -Possible problems -------------------- - -* qgep schema of demodata has missing foreignkeys: Einleitstelle.fs_Gewaessersektor, Versickerungsanlage.fs_Grundwasserleiter, Abwasserknoten.fs_hydrgeomref –> check whether ok in empty schema ``qgep``. - -* Need to use ``ST_Force3D`` for geometries – because qgep model is now with 3D coordinates - -* If identifier in table is not unique there will be an error on the import of the table: - ->>> FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint „in_od_wastewater_structure_identifier“ -DETAIL: Schlüssel „(identifier, fk_dataowner)=(V1.100, ch080qwzOG000098)“ existiert bereits. -********** Error ********** -FEHLER: doppelter Schlüsselwert verletzt Unique-Constraint „in_od_wastewater_structure_identifier“ -SQL state: 23505 -Detail: Schlüssel „(identifier, fk_dataowner)=(V1.100, ch080qwzOG000098)“ existiert bereits. - -* Change identifier V1.100 to V1.100.2 in class **abwasserbauwerk** for Transferdatensatz VSA 2015 to avoid conflict in qgep schema having the same combination identifier / fk_dataowner. - - .. figure:: images/unique_identifier_dataowner.jpg - diff --git a/en/admin-guide/index.rst b/en/admin-guide/index.rst index 5c320635c..afd0bc36c 100644 --- a/en/admin-guide/index.rst +++ b/en/admin-guide/index.rst @@ -7,9 +7,13 @@ This represents a guide on how to administrate the database, install a Virtual m :maxdepth: 2 pgadmin/index - data-import/index data-export/index - + data-import/index +In discussion: +* dxf (in progress) +* Shape +* MOUSE / MikeUrban (please connect with the developer team if you are interested in this) +* other diff --git a/en/index.rst b/en/index.rst index 8307b88d0..b6779ceaa 100644 --- a/en/index.rst +++ b/en/index.rst @@ -1,9 +1,11 @@ This is the QGEP documentation ============================== -QGEP is a wastewater management module for QGIS based on SIA 405 (Leitungskataster) and VSA-DSS (GEP) and developed closely to the QGIS application. +QGEP is a wastewater management module for QGIS based on SIA 405 Waste water (Leitungskataster) and VSA-DSS (GEP) and developed closely to the QGIS application. -This document can also be downloaded as a single PDF document: `QGEP.pdf <./QGEP.pdf>`__ |image|. +.. + Commented out pdf for the moment - needs new code + This document can also be downloaded as a single PDF document: `QGEP.pdf <./QGEP.pdf>`__ |image|. .. |image| image:: ../_static/pdf.png :height: 15 @@ -15,7 +17,7 @@ Contents ======== .. toctree:: - :maxdepth: 3 + :maxdepth: 4 :numbered: installation-guide/index diff --git a/en/installation-guide/database-initialization.rst b/en/installation-guide/database-initialization.rst index 81830fe28..dca66ecc3 100644 --- a/en/installation-guide/database-initialization.rst +++ b/en/installation-guide/database-initialization.rst @@ -46,15 +46,15 @@ Restore demo datamodel Restore the latest data model that also includes demo data: * Download demo data - * https://github.com/QGEP/datamodel/releases/latest * download `qgep_vx.y.z_structure_and_demo_data.backup` + * Right click the `qgep` schema * Click `Restore` - * Load your download of qgep.backup + * Load your download of qgep_demodata.backup .. figure:: images/qgep_restore.jpg diff --git a/en/installation-guide/images/umgebungsvariablen_pgconfdir.jpg b/en/installation-guide/images/umgebungsvariablen_pgconfdir.jpg new file mode 100644 index 000000000..0a83ad4cb Binary files /dev/null and b/en/installation-guide/images/umgebungsvariablen_pgconfdir.jpg differ diff --git a/en/installation-guide/workstation.rst b/en/installation-guide/workstation.rst index 856ac7e68..6ff162fdc 100644 --- a/en/installation-guide/workstation.rst +++ b/en/installation-guide/workstation.rst @@ -18,6 +18,16 @@ Create a new directory where you want to store the configuration in. (E.g. a new 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`` diff --git a/en/user-guide/editing/editing.rst b/en/user-guide/editing/editing.rst index 9daef04bf..61376f541 100644 --- a/en/user-guide/editing/editing.rst +++ b/en/user-guide/editing/editing.rst @@ -139,11 +139,19 @@ In QGEP, there is in the moment no tool, that helps you to connect a wastewater .. note:: If you really want to connect the node to a channel, then type the obj_id of the channel manualy in the fk_wasterwater_structure field of the node. + +Multiedit +--------- +If you want to edit attributes for multiple objects of the same class you can use the `multiedit Tool of QGIS `_. + + Saving changes -------------- * Click **Save** and then deactivate the edit mode or click on **Stop data entry** if you have worked with the **QGEP Data Entry** wizard. + +======= Changing Wastewater Structure Type ----------------------------------