diff --git a/docs/stefans_scripts/export/90_refresh_materialized_view.sql b/docs/stefans_scripts/export/90_refresh_materialized_view.sql new file mode 100644 index 00000000..59239c76 --- /dev/null +++ b/docs/stefans_scripts/export/90_refresh_materialized_view.sql @@ -0,0 +1,2 @@ +REFRESH MATERIALIZED VIEW qgep_od.vw_network_node; +REFRESH MATERIALIZED VIEW qgep_od.vw_network_segment; diff --git a/docs/stefans_scripts/export/91_maincover.sql b/docs/stefans_scripts/export/91_maincover.sql new file mode 100644 index 00000000..348f4b14 --- /dev/null +++ b/docs/stefans_scripts/export/91_maincover.sql @@ -0,0 +1,10 @@ +UPDATE qgep_od.wastewater_structure WS +SET fk_main_cover = structure_cover.co_obj_id +FROM ( + SELECT WS.obj_id AS obj_id, min(CO.obj_id) AS co_obj_id + FROM qgep_od.wastewater_structure WS + LEFT JOIN qgep_od.structure_part SP ON SP.fk_wastewater_structure = WS.obj_id + LEFT JOIN qgep_od.cover CO ON SP.obj_id = CO.obj_id + GROUP BY WS.obj_id +) AS structure_cover +WHERE structure_cover.obj_id = WS.obj_id; diff --git a/docs/stefans_scripts/export/92_grant_usage.sql b/docs/stefans_scripts/export/92_grant_usage.sql new file mode 100644 index 00000000..5713c0ce --- /dev/null +++ b/docs/stefans_scripts/export/92_grant_usage.sql @@ -0,0 +1,3 @@ +GRANT USAGE ON SCHEMA qgep_od TO GROUP qgep; +GRANT USAGE ON SCHEMA qgep_sys TO GROUP qgep; +GRANT USAGE ON SCHEMA qgep_vl TO GROUP qgep; diff --git a/docs/stefans_scripts/export/93_grant_all.sql b/docs/stefans_scripts/export/93_grant_all.sql new file mode 100644 index 00000000..575bad42 --- /dev/null +++ b/docs/stefans_scripts/export/93_grant_all.sql @@ -0,0 +1,3 @@ +GRANT ALL ON schema qgep_od TO postgres; +GRANT ALL ON schema qgep_sys TO postgres; +GRANT ALL ON schema qgep_vl TO postgres; diff --git a/docs/stefans_scripts/export/check_coordinate_cover.sql b/docs/stefans_scripts/export/check_coordinate_cover.sql new file mode 100644 index 00000000..2e38bbee --- /dev/null +++ b/docs/stefans_scripts/export/check_coordinate_cover.sql @@ -0,0 +1,3 @@ +SELECT +ST_AsText(situation_geometry) as deckelkoordinaten + FROM qgep_od.cover ORDER BY deckelkoordinaten ASC; diff --git a/docs/stefans_scripts/export/check_coordinate_reach_point.sql b/docs/stefans_scripts/export/check_coordinate_reach_point.sql new file mode 100644 index 00000000..9e08bbfb --- /dev/null +++ b/docs/stefans_scripts/export/check_coordinate_reach_point.sql @@ -0,0 +1,3 @@ +SELECT +ST_AsText(situation_geometry) as hpkoordinaten, obj_id + FROM qgep_od.reach_point ORDER BY hpkoordinaten ASC; diff --git a/docs/stefans_scripts/export/check_coordinate_wastewaternode.sql b/docs/stefans_scripts/export/check_coordinate_wastewaternode.sql new file mode 100644 index 00000000..4e54aa79 --- /dev/null +++ b/docs/stefans_scripts/export/check_coordinate_wastewaternode.sql @@ -0,0 +1,3 @@ +SELECT +ST_AsText(situation_geometry) as abwasserknotenkoordinaten, obj_id + FROM qgep_od.wastewater_node ORDER BY abwasserknotenkoordinaten ASC; diff --git a/docs/stefans_scripts/export/check_length_detail_geometry.sql b/docs/stefans_scripts/export/check_length_detail_geometry.sql new file mode 100644 index 00000000..c2ad98ec --- /dev/null +++ b/docs/stefans_scripts/export/check_length_detail_geometry.sql @@ -0,0 +1,4 @@ +SELECT, +ST_AsText(detail_geometry_geometry) as koordinatendetailgeometrie, + st_length(detail_geometry_geometry) AS length_full, obj_id + FROM qgep_od.wastewater_structure ORDER BY length_full ASC; diff --git a/docs/stefans_scripts/export/check_length_reach.sql b/docs/stefans_scripts/export/check_length_reach.sql new file mode 100644 index 00000000..d2ed546a --- /dev/null +++ b/docs/stefans_scripts/export/check_length_reach.sql @@ -0,0 +1,4 @@ +SELECT +ST_AsText(progression_geometry) as koordinaten, + st_length(progression_geometry) AS length_full, obj_id + FROM qgep_od.reach ORDER BY length_full ASC; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/01_sia405_abwasser_2015_2_d_tid_generate.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/01_sia405_abwasser_2015_2_d_tid_generate.sql new file mode 100644 index 00000000..e13be2ef --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/01_sia405_abwasser_2015_2_d_tid_generate.sql @@ -0,0 +1,53 @@ +-- this file generates a new SQL function to create TIDs for all the tables of the import/export schema with ili2pg. +-- you need to set the current maxvalue of the TID into the schema.table.field sia405_abwasser_2015_2_d.t_key_object.t_lastuniqueid +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_generate.sql +-- schema für export heisst abwa_2015neu_3122 + + +-- function for generating TIDs +CREATE OR REPLACE FUNCTION sia405_abwasser_2015_2_d.tid_generate(table_name text, obj_id_table text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + nexttid integer; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('sia405_abwasser_2015_2_d.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + -- 23.12.2015 SELECT t_lastuniqueid FROM sia405_abwasser_2015_2_d.t_key_object AS nexttid; + SELECT t_lastuniqueid INTO nexttid FROM sia405_abwasser_2015_2_d.t_key_object; + newtid = (nexttid + 1); + + -- 12.1.2016 + RAISE NOTICE 'newtid is %', newtid; -- Print newtid + RAISE NOTICE 'nexttid is %', nexttid; -- Print nexttid + + -- adapt t_lastuniqueid in t_key_object + UPDATE sia405_abwasser_2015_2_d.t_key_object + SET t_lastuniqueid = newtid + , t_user = current_user + , t_createdate = current_timestamp + WHERE t_lastuniqueid = nexttid; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table % not found', table_name; + ELSE + RAISE NOTICE 't_key_object updated'; + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN newtid; + + + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/022_sia405_abwasser_2015_2_d_basket_update.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/022_sia405_abwasser_2015_2_d_basket_update.sql new file mode 100644 index 00000000..a21d0a97 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/022_sia405_abwasser_2015_2_d_basket_update.sql @@ -0,0 +1,51 @@ +-- neu 26.11.2016 Stefan Burckhardt +-- Updates data in sia405_abwasser_2015_2_d.t_ili2db_import_basket with last tid from t_key_object + +-- Function: SELECT sia405_abwasser_2015_2_d.basket_update(); + +DROP FUNCTION IF EXISTS sia405_abwasser_2015_2_d.basket_update(); + +CREATE OR REPLACE FUNCTION sia405_abwasser_2015_2_d.basket_update() + RETURNS integer AS +$BODY$ +DECLARE + lasttid integer; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('sia405_abwasser_2015_2_d_301.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + + SELECT t_lastuniqueid INTO lasttid FROM sia405_abwasser_2015_2_d.t_key_object; + + + -- 25.11.2016 + RAISE NOTICE '[basket_updtae]: lasttid is %', lasttid; -- Print lasttid + + + -- adapt t_lastuniqueid in t_key_object + UPDATE sia405_abwasser_2015_2_d.t_ili2db_import_basket + SET t_id = lasttid + 1 + , end_t_id = lasttid + , objectcount = lasttid - 2 + WHERE import = 2; + + IF NOT FOUND THEN + RAISE NOTICE 'sequence for table basket_update not found - first data will be inserted'; + INSERT INTO sia405_abwasser_2015_2_d.t_ili2db_import_basket (t_id, import, basket, objectcount, start_t_id, end_t_id) VALUES (lasttid + 1, 2, 3, lasttid - 2, 3, lasttid); + + ELSE + RAISE NOTICE 't_ili2db_import_basket updated %', lasttid; + -- SELECT setval (sia405_abwasser_2015_2_d_340.t_ili2db_seq, lasttid + 1); + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN lasttid; + + + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION sia405_abwasser_2015_2_d.basket_update() + OWNER TO postgres; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/022_vsa_dss_2015_2_d_3122_basket_update.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/022_vsa_dss_2015_2_d_3122_basket_update.sql new file mode 100644 index 00000000..8b6b7b51 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/022_vsa_dss_2015_2_d_3122_basket_update.sql @@ -0,0 +1,51 @@ +-- neu 26.11.2016 Stefan Burckhardt / 4.7.2017 corrected / 9.10.2018 +-- Updates data in vsa_dss_2015_2_d_3122.t_ili2db_import_basket with last tid from t_key_object + +-- Function: vsa_dss_2015_2_d_3122.basket_update() + +-- DROP FUNCTION vsa_dss_2015_2_d_3122.basket_update(); + +CREATE OR REPLACE FUNCTION vsa_dss_2015_2_d_3122.basket_update() + RETURNS integer AS +$BODY$ +DECLARE + lasttid integer; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('sia405_abwasser_2015_2_d_301.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + + SELECT t_lastuniqueid INTO lasttid FROM vsa_dss_2015_2_d_3122.t_key_object; + + + -- 25.11.2016 + RAISE NOTICE '[basket_update]: lasttid is %', lasttid; -- Print lasttid + + + -- adapt t_lastuniqueid in t_key_object + UPDATE vsa_dss_2015_2_d_3122.t_ili2db_import_basket + SET t_id = lasttid + 1 + , end_t_id = lasttid + , objectcount = lasttid - 2 + WHERE import = 2; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table basket_update not found - first data will be inserte'; + INSERT INTO vsa_dss_2015_d_391.t_ili2db_import_basket (t_id, import, basket, objectcount, start_t_id, end_t_id) VALUES (lasttid + 1, 2, 3, lasttid - 2, 3, lasttid); + + ELSE + RAISE NOTICE 't_ili2db_import_basket updated %', lasttid; + -- SELECT setval (sia405_abwasser_2015_2_d_340.t_ili2db_seq, lasttid + 1); + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN lasttid; + + + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION vsa_dss_2015_2_d_3122.basket_update() + OWNER TO postgres; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/02_sia405_abwasser_2015_2_d_tid_lookup.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/02_sia405_abwasser_2015_2_d_tid_lookup.sql new file mode 100644 index 00000000..d18524e0 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/02_sia405_abwasser_2015_2_d_tid_lookup.sql @@ -0,0 +1,51 @@ +-- this file looks up the t_id for foreignkeys (OID) for the tables of the import/export schema with ili2pg. +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_lookup.sql +-- schema für export heisst sia405_abwasser_2015_2_d. +-- last update 18.11.2016 Stefan Burckhardt + +-- function for looking up t_id +CREATE OR REPLACE FUNCTION sia405_abwasser_2015_2_d.tid_lookup(table_name text, obj_id_ref text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + tid_ref integer; + -- newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + -- 9.3.2016 check whether obj_id_ref NOT IS NULL + IF obj_id_ref IS NULL THEN + tid_ref = NULL; + RAISE NOTICE '[tid_lookup]: obj_id is NULL . tid_ref set NULL also'; -- Print newtid + ELSE + -- get tid_ref for foreignkey + -- SELECT t_id INTO tid_ref FROM sia405_abwasser_2015_2_d.baseclass WHERE t_ili_tid = 'ch13p7mzOG000002'; + SELECT t_id INTO tid_ref FROM sia405_abwasser_2015_2_d.baseclass WHERE t_ili_tid = obj_id_ref; + + IF NOT FOUND THEN + -- 13.2.2016 / 9.3.2016 improved error message + -- RAISE EXCEPTION 'tid_ref for table % not found', table_name; + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref for table % not found', table_name; + RAISE EXCEPTION 'Missing t_id in table baseclass'; + + ELSE + -- 12.1.2016 + -- 13.2.2016 comment out to speed up + -- 9.3.2016 Hineis ergänzt mit OBJ_ID + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref is %', tid_ref; + + END IF; + END IF; + + RETURN tid_ref; + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/046_sia405_abwasser_2015_2_d_t_key_object_insert_metadata.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/046_sia405_abwasser_2015_2_d_t_key_object_insert_metadata.sql new file mode 100644 index 00000000..1ab3c5ed --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/046_sia405_abwasser_2015_2_d_t_key_object_insert_metadata.sql @@ -0,0 +1,25 @@ +-- 24.11.2016 auch create statement nötig, Tabelle fehlt in --createscript (an Eisenhut gemeldet) +-- Stefan Burckhardt + +-- Table: sia405_abwasser_2015_2_d.t_key_object + +DROP TABLE IF EXISTS sia405_abwasser_2015_2_d.t_key_object; + +CREATE TABLE sia405_abwasser_2015_2_d.t_key_object +( + t_key character varying(30) NOT NULL, + t_lastuniqueid integer NOT NULL, + t_lastchange timestamp without time zone NOT NULL, + t_createdate timestamp without time zone NOT NULL, + t_user character varying(40) NOT NULL, + CONSTRAINT t_key_object_pkey PRIMARY KEY (t_key) +) +WITH ( + OIDS=FALSE +); +ALTER TABLE sia405_abwasser_2015_2_d.t_key_object + OWNER TO postgres; + +-- erster Eintrag in t_key_object + +INSERT INTO sia405_abwasser_2015_2_d.t_key_object (t_key, t_lastuniqueid, t_lastchange, t_createdate, t_user) VALUES ( 't_id', 0, current_timestamp, current_timestamp, 'postgres'); diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/050_sia405_abwasser_2015_2.vw_sia405_baseclass_metattribute.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/050_sia405_abwasser_2015_2.vw_sia405_baseclass_metattribute.sql new file mode 100644 index 00000000..1ad6136c --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/050_sia405_abwasser_2015_2.vw_sia405_baseclass_metattribute.sql @@ -0,0 +1,15 @@ +-- View: sia405_abwasser_2015_2_d.vw_sia405_baseclass_metaattribute + +-- DROP VIEW IF EXISTS sia405_abwasser_2015_2_d.vw_sia405_baseclass_metaattribute; + +CREATE OR REPLACE VIEW sia405_abwasser_2015_2_d.vw_sia405_baseclass_metaattribute AS + SELECT sia405_baseclass.t_id, + sia405_baseclass.obj_id, + metaattribute.datenherr, + metaattribute.datenlieferant, + metaattribute.letzte_aenderung + FROM sia405_abwasser_2015_2_d.sia405_baseclass + LEFT JOIN sia405_abwasser_2015_2_d.metaattribute ON sia405_baseclass.t_id = metaattribute.sia405_baseclass_metaattribute; + +ALTER TABLE sia405_abwasser_2015_2_d.vw_sia405_baseclass_metaattribute + OWNER TO postgres; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/051_sia405_abwasser_2015_2_d_interlisexport2.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/051_sia405_abwasser_2015_2_d_interlisexport2.sql new file mode 100644 index 00000000..42075f11 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/051_sia405_abwasser_2015_2_d_interlisexport2.sql @@ -0,0 +1,121 @@ +------ This file is sql code to Export QGEP (Modul SIA405Abwasser) in English to INTERLIS in German on QQIS +------ Second version using tid_generate and tid_lookup +------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch +------ version 15.03.2016 14:19:45 / modified 15.8.2019 neue schemata + +DELETE FROM sia405_abwasser_2015_2_d.organisation; +DELETE FROM sia405_abwasser_2015_2_d.abwasserbauwerk; +DELETE FROM sia405_abwasser_2015_2_d.kanal; +DELETE FROM sia405_abwasser_2015_2_d.normschacht; +DELETE FROM sia405_abwasser_2015_2_d.einleitstelle; +DELETE FROM sia405_abwasser_2015_2_d.spezialbauwerk; +DELETE FROM sia405_abwasser_2015_2_d.versickerungsanlage; +DELETE FROM sia405_abwasser_2015_2_d.rohrprofil; +DELETE FROM sia405_abwasser_2015_2_d.abwassernetzelement; +DELETE FROM sia405_abwasser_2015_2_d.haltungspunkt; +DELETE FROM sia405_abwasser_2015_2_d.abwasserknoten; +DELETE FROM sia405_abwasser_2015_2_d.haltung; +DELETE FROM sia405_abwasser_2015_2_d.bauwerksteil; +DELETE FROM sia405_abwasser_2015_2_d.trockenwetterfallrohr; +DELETE FROM sia405_abwasser_2015_2_d.einstiegshilfe; +DELETE FROM sia405_abwasser_2015_2_d.trockenwetterrinne; +DELETE FROM sia405_abwasser_2015_2_d.deckel; +DELETE FROM sia405_abwasser_2015_2_d.bankett; + +DELETE FROM sia405_abwasser_2015_2_d.metaattribute; +DELETE FROM sia405_abwasser_2015_2_d.sia405_baseclass; +DELETE FROM sia405_abwasser_2015_2_d.baseclass; + +--- t_key_object initialisieren + +UPDATE sia405_abwasser_2015_2_d.t_key_object SET t_lastuniqueid = 0, t_createdate = current_timestamp, t_user = 'postgres'; + + +-- neu 15.8.2019 falls noch keine Daten drin +-- INSERT INTO sia405_abwasser_2015_2_d.t_ili2db_dataset (t_id, datasetname) VALUES (1, 'qgep.xtf-1'); + +-- INSERT INTO sia405_abwasser_2015_2_d.t_ili2db_import (t_id, dataset, importdate, importuser, importfile) VALUES (2, 1, current_timestamp, 'postgres', 'qgep.xtf'); + +-- INSERT INTO sia405_abwasser_2015_2_d.t_ili2db_basket (t_id, dataset, topic, attachmentkey) VALUES (3, 1, 'SIA405_ABWASSER_2015.SIA405_Abwasser', 'qgep.xtf-3'); + +-- INSERT INTO sia405_abwasser_2015_2_d.t_ili2db_import_basket (t_id, dataset, importdate, importuser, importfile) VALUES (2, 1, current_timestamp, 'postgres', 'qgep.xtf'); + +--- OK: fk_Attributes +--- OK: JOIN for fk_dataowner / provider +--- in Progress: organisation.fk_part_of data - prepared, but no qgep.table hierarchy and data, dito for all other class - class associations +--- Not tested: if data with reach - reach connection +--- abwasserbauwerk.detailgeometrie and haltung.verlauf commented out as long qgep has not geometry datatypes that allow ARCS + + + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('bauwerksteil', obj_id), 'bauwerksteil', obj_id +FROM qgep_od.structure_part; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('bauwerksteil', obj_id), obj_id +FROM qgep_od.structure_part; + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('haltungspunkt', obj_id), 'haltungspunkt', obj_id +FROM qgep_od.reach_point; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('haltungspunkt', obj_id), obj_id +FROM qgep_od.reach_point; + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('abwassernetzelement', obj_id), 'abwassernetzelement', obj_id +FROM qgep_od.wastewater_networkelement; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwassernetzelement', obj_id), obj_id +FROM qgep_od.wastewater_networkelement; + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('rohrprofil', obj_id), 'rohrprofil', obj_id +FROM qgep_od.pipe_profile; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('rohrprofil', obj_id), obj_id +FROM qgep_od.pipe_profile; + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('abwasserbauwerk', obj_id), 'abwasserbauwerk', obj_id +FROM qgep_od.wastewater_structure; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwasserbauwerk', obj_id), obj_id +FROM qgep_od.wastewater_structure; + +INSERT INTO sia405_abwasser_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT sia405_abwasser_2015_2_d.tid_generate('organisation', obj_id), 'organisation', obj_id +FROM qgep_od.organisation; + +INSERT INTO sia405_abwasser_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT sia405_abwasser_2015_2_d.tid_lookup('organisation', obj_id), obj_id +FROM qgep_od.organisation; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/052a_sia405_abwasser_2015_2_d_interlisexport2.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/052a_sia405_abwasser_2015_2_d_interlisexport2.sql new file mode 100644 index 00000000..734ece1b --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/052a_sia405_abwasser_2015_2_d_interlisexport2.sql @@ -0,0 +1,616 @@ +------ This file is sql code to Export QGEP (Modul SIA405Abwasser) in English to INTERLIS in German on QQIS +------ Second version using tid_generate and tid_lookup +------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch +------ version 15.03.2016 14:19:45 +--- modified 15.8.2019 schema anpassung +--- modified 15.8.2019 sia405_base_sia405_baseclass_metaattribute -> sia405_baseclass_metaattribute +--- ST_Force2D für Geometrien eingefügt: qgep_od.wastewater_structure.detail_geometry_geometry, qgep_od.reach_point.situation_geometry, qgep_od.wastewater_node.situation_geometry, qgep_od.reach.progression_geometry, qgep_od.cover.situation_geometry + +-- DELETE FROM sia405_abwasser_2015_2_d.organisation; + +INSERT INTO sia405_abwasser_2015_2_d.organisation +( +t_id, bezeichnung, bemerkung, uid) +SELECT sia405_abwasser_2015_2_d.tid_lookup('organisation', obj_id), identifier, remark, uid +FROM qgep_od.organisation; + +-- additional Table Assoc: Organisation_Teil_von/ no table hierarchy in qgep schema yet (check how to implement there) +-- INSERT INTO sia405_abwasser_2015_2_d.Organisation_Teil_vonassoc +-- ( +-- t_id, Teil_vonref, Organisation_Teil_vonassocref) +-- SELECT sia405_abwasser_2015_2_d.tid_lookup('Organisation', obj_id), sia405_abwasser_2015_2_d.tid_lookup('Organisation', fk_part_of),sia405_abwasser_2015_2_d.tid_lookup('Organisation', obj_id) +-- FROM qgep_od.organisation; + + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('organisation', qgep_od.organisation.obj_id), '0', a.identifier as dataowner, b.identifier as provider, organisation.last_modification, sia405_abwasser_2015_2_d.tid_lookup('organisation', qgep_od.organisation.obj_id) +FROM qgep_od.organisation + LEFT JOIN qgep_od.organisation as a ON organisation.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON organisation.fk_provider = b.obj_id; + + +INSERT INTO sia405_abwasser_2015_2_d.abwasserbauwerk +(t_id, zugaenglichkeit, baulos, detailgeometrie, finanzierung, bruttokosten, bezeichnung, inspektionsintervall, standortname, akten, bemerkung, sanierungsbedarf, wiederbeschaffungswert, wbw_basisjahr, wbw_bauart, status, baulicherzustand, subventionen, baujahr, ersatzjahr, eigentuemerref, betreiberref) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwasserbauwerk', obj_id), +CASE WHEN accessibility = 3444 THEN 'ueberdeckt' ---- 3444 covered +WHEN accessibility = 3447 THEN 'unbekannt' ---- 3447 unknown +WHEN accessibility = 3446 THEN 'unzugaenglich' ---- 3446 inaccessible +WHEN accessibility = 3445 THEN 'zugaenglich' ---- 3445 accessible +END, +contract_section, +-- detail_geometry_geometry, +ST_Force2D(detail_geometry_geometry), +CASE WHEN financing = 5510 THEN 'oeffentlich' ---- 5510 public +WHEN financing = 5511 THEN 'privat' ---- 5511 private +WHEN financing = 5512 THEN 'unbekannt' ---- 5512 unknown +END, gross_costs, identifier, inspection_interval, location_name, records, remark, +CASE WHEN renovation_necessity = 5370 THEN 'dringend' ---- 5370 urgent +WHEN renovation_necessity = 5368 THEN 'keiner' ---- 5368 none +WHEN renovation_necessity = 2 THEN 'kurzfristig' ---- 2 short_term +WHEN renovation_necessity = 4 THEN 'langfristig' ---- 4 long_term +WHEN renovation_necessity = 3 THEN 'mittelfristig' ---- 3 medium_term +WHEN renovation_necessity = 5369 THEN 'unbekannt' ---- 5369 unknown +END, replacement_value, rv_base_year, +CASE WHEN rv_construction_type = 4602 THEN 'andere' ---- 4602 other +WHEN rv_construction_type = 4603 THEN 'Feld' ---- 4603 field +WHEN rv_construction_type = 4606 THEN 'Sanierungsleitung_Bagger' ---- 4606 renovation_conduction_excavator +WHEN rv_construction_type = 4605 THEN 'Sanierungsleitung_Grabenfraese' ---- 4605 renovation_conduction_ditch_cutter +WHEN rv_construction_type = 4604 THEN 'Strasse' ---- 4604 road +WHEN rv_construction_type = 4601 THEN 'unbekannt' ---- 4601 unknown +END, +CASE WHEN status = 8493 THEN 'in_Betrieb' +WHEN status = 3027 THEN 'unbekannt' +WHEN status = 3633 THEN 'ausser_Betrieb' +END, +CASE WHEN structure_condition = 3037 THEN 'unbekannt' ---- 3037 unknown +WHEN structure_condition = 3363 THEN 'Z0' ---- 3363 Z0 +WHEN structure_condition = 3359 THEN 'Z1' ---- 3359 Z1 +WHEN structure_condition = 3360 THEN 'Z2' ---- 3360 Z2 +WHEN structure_condition = 3361 THEN 'Z3' ---- 3361 Z3 +WHEN structure_condition = 3362 THEN 'Z4' ---- 3362 Z4 +END, subsidies, year_of_construction, year_of_replacement, sia405_abwasser_2015_2_d.tid_lookup('Organisation', fk_owner), sia405_abwasser_2015_2_d.tid_lookup('Organisation', fk_operator) +FROM qgep_od.wastewater_structure; + + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwasserbauwerk', qgep_od.wastewater_structure.obj_id), '0', a.identifier as dataowner, b.identifier as provider, wastewater_structure.last_modification, sia405_abwasser_2015_2_d.tid_lookup('abwasserbauwerk', qgep_od.wastewater_structure.obj_id) +FROM qgep_od.wastewater_structure + LEFT JOIN qgep_od.organisation as a ON wastewater_structure.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON wastewater_structure.fk_provider = b.obj_id; + +INSERT INTO sia405_abwasser_2015_2_d.kanal +( +t_id, bettung_umhuellung, verbindungsart, funktionhierarchisch, funktionhydraulisch, spuelintervall, rohrlaenge, nutzungsart_ist, nutzungsart_geplant) +SELECT sia405_abwasser_2015_2_d.tid_lookup('kanal', obj_id), +CASE WHEN bedding_encasement = 5325 THEN 'andere' ---- 5325 other +WHEN bedding_encasement = 5332 THEN 'erdverlegt' ---- 5332 in_soil +WHEN bedding_encasement = 5328 THEN 'in_Kanal_aufgehaengt' ---- 5328 in_channel_suspended +WHEN bedding_encasement = 5339 THEN 'in_Kanal_einbetoniert' ---- 5339 in_channel_concrete_casted +WHEN bedding_encasement = 5331 THEN 'in_Leitungsgang' ---- 5331 in_walk_in_passage +WHEN bedding_encasement = 5337 THEN 'in_Vortriebsrohr_Beton' ---- 5337 in_jacking_pipe_concrete +WHEN bedding_encasement = 5336 THEN 'in_Vortriebsrohr_Stahl' ---- 5336 in_jacking_pipe_steel +WHEN bedding_encasement = 5335 THEN 'Sand' ---- 5335 sand +WHEN bedding_encasement = 5333 THEN 'SIA_Typ1' ---- 5333 sia_type_1 +WHEN bedding_encasement = 5330 THEN 'SIA_Typ2' ---- 5330 sia_type_2 +WHEN bedding_encasement = 5334 THEN 'SIA_Typ3' ---- 5334 sia_type_3 +WHEN bedding_encasement = 5340 THEN 'SIA_Typ4' ---- 5340 sia_type_4 +WHEN bedding_encasement = 5327 THEN 'Sohlbrett' ---- 5327 bed_plank +WHEN bedding_encasement = 5329 THEN 'unbekannt' ---- 5329 unknown +END, +CASE WHEN connection_type = 5341 THEN 'andere' ---- 5341 other +WHEN connection_type = 190 THEN 'Elektroschweissmuffen' ---- 190 electric_welded_sleeves +WHEN connection_type = 187 THEN 'Flachmuffen' ---- 187 flat_sleeves +WHEN connection_type = 193 THEN 'Flansch' ---- 193 flange +WHEN connection_type = 185 THEN 'Glockenmuffen' ---- 185 bell_shaped_sleeves +WHEN connection_type = 192 THEN 'Kupplung' ---- 192 coupling +WHEN connection_type = 194 THEN 'Schraubmuffen' ---- 194 screwed_sleeves +WHEN connection_type = 189 THEN 'spiegelgeschweisst' ---- 189 butt_welded +WHEN connection_type = 186 THEN 'Spitzmuffen' ---- 186 beaked_sleeves +WHEN connection_type = 191 THEN 'Steckmuffen' ---- 191 push_fit_sleeves +WHEN connection_type = 188 THEN 'Ueberschiebmuffen' ---- 188 slip_on_sleeves +WHEN connection_type = 3036 THEN 'unbekannt' ---- 3036 unknown +WHEN connection_type = 3666 THEN 'Vortriebsrohrkupplung' ---- 3666 jacking_pipe_coupling +END, +CASE WHEN function_hierarchic = 5069 THEN 'PAA.Hauptsammelkanal' +WHEN function_hierarchic = 5070 THEN 'andere' +END, +CASE WHEN function_hydraulic = 5320 THEN 'andere' ---- 5320 other +WHEN function_hydraulic = 2546 THEN 'Drainagetransportleitung' ---- 2546 drainage_transportation_pipe +WHEN function_hydraulic = 22 THEN 'Drosselleitung' ---- 22 restriction_pipe +WHEN function_hydraulic = 3610 THEN 'Duekerleitung' ---- 3610 inverted_syphon +WHEN function_hydraulic = 367 THEN 'Freispiegelleitung' ---- 367 gravity_pipe +WHEN function_hydraulic = 23 THEN 'Pumpendruckleitung' ---- 23 pump_pressure_pipe +WHEN function_hydraulic = 145 THEN 'Sickerleitung' ---- 145 seepage_water_drain +WHEN function_hydraulic = 21 THEN 'Speicherleitung' ---- 21 retention_pipe +WHEN function_hydraulic = 144 THEN 'Spuelleitung' ---- 144 jetting_pipe +WHEN function_hydraulic = 5321 THEN 'unbekannt' ---- 5321 unknown +WHEN function_hydraulic = 3655 THEN 'Vakuumleitung' ---- 3655 vacuum_pipe +END, jetting_interval, pipe_length, +CASE WHEN usage_current = 5322 THEN 'andere' ---- 5322 other +WHEN usage_current = 4518 THEN 'Bachwasser' ---- 4518 creek_water +WHEN usage_current = 4516 THEN 'entlastetes_Mischabwasser' ---- 4516 discharged_combined_wastewater +WHEN usage_current = 4524 THEN 'Industrieabwasser' ---- 4524 industrial_wastewater +WHEN usage_current = 4522 THEN 'Mischabwasser' ---- 4522 combined_wastewater +WHEN usage_current = 4520 THEN 'Regenabwasser' ---- 4520 rain_wastewater +WHEN usage_current = 4514 THEN 'Reinabwasser' ---- 4514 clean_wastewater +WHEN usage_current = 4526 THEN 'Schmutzabwasser' ---- 4526 wastewater +WHEN usage_current = 4571 THEN 'unbekannt' ---- 4571 unknown +END, +CASE WHEN usage_planned = 5323 THEN 'andere' ---- 5323 other +WHEN usage_planned = 4519 THEN 'Bachwasser' ---- 4519 creek_water +WHEN usage_planned = 4517 THEN 'entlastetes_Mischabwasser' ---- 4517 discharged_combined_wastewater +WHEN usage_planned = 4525 THEN 'Industrieabwasser' ---- 4525 industrial_wastewater +WHEN usage_planned = 4523 THEN 'Mischabwasser' ---- 4523 combined_wastewater +WHEN usage_planned = 4521 THEN 'Regenabwasser' ---- 4521 rain_wastewater +WHEN usage_planned = 4515 THEN 'Reinabwasser' ---- 4515 clean_wastewater +WHEN usage_planned = 4527 THEN 'Schmutzabwasser' ---- 4527 wastewater +WHEN usage_planned = 4569 THEN 'unbekannt' ---- 4569 unknown +END +FROM qgep_od.channel; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'kanal' +FROM + sia405_abwasser_2015_2_d.kanal a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.normschacht +( +t_id, dimension1, dimension2, funktion, material, oberflaechenzulauf) +SELECT sia405_abwasser_2015_2_d.tid_lookup('normschacht', obj_id), dimension1, dimension2, +CASE WHEN function = 4532 THEN 'Absturzbauwerk' ---- 4532 drop_structure +WHEN function = 5344 THEN 'andere' ---- 5344 other +WHEN function = 4533 THEN 'Be_Entlueftung' ---- 4533 venting +WHEN function = 3267 THEN 'Dachwasserschacht' ---- 3267 rain_water_manhole +WHEN function = 3266 THEN 'Einlaufschacht' ---- 3266 gully +WHEN function = 3472 THEN 'Entwaesserungsrinne' ---- 3472 drainage_channel +WHEN function = 228 THEN 'Geleiseschacht' ---- 228 rail_track_gully +WHEN function = 204 THEN 'Kontrollschacht' ---- 204 manhole +WHEN function = 1008 THEN 'Oelabscheider' ---- 1008 oil_separator +WHEN function = 4536 THEN 'Pumpwerk' ---- 4536 pump_station +WHEN function = 5346 THEN 'Regenueberlauf' ---- 5346 stormwater_overflow +WHEN function = 2742 THEN 'Schlammsammler' ---- 2742 slurry_collector +WHEN function = 5347 THEN 'Schwimmstoffabscheider' ---- 5347 floating_material_separator +WHEN function = 4537 THEN 'Spuelschacht' ---- 4537 jetting_manhole +WHEN function = 4798 THEN 'Trennbauwerk' ---- 4798 separating_structure +WHEN function = 5345 THEN 'unbekannt' ---- 5345 unknown +END, +CASE WHEN material = 4540 THEN 'andere' ---- 4540 other +WHEN material = 4541 THEN 'Beton' ---- 4541 concrete +WHEN material = 4542 THEN 'Kunststoff' ---- 4542 plastic +WHEN material = 4543 THEN 'unbekannt' ---- 4543 unknown +END, +CASE WHEN surface_inflow = 5342 THEN 'andere' ---- 5342 other +WHEN surface_inflow = 2741 THEN 'keiner' ---- 2741 none +WHEN surface_inflow = 2739 THEN 'Rost' ---- 2739 grid +WHEN surface_inflow = 5343 THEN 'unbekannt' ---- 5343 unknown +WHEN surface_inflow = 2740 THEN 'Zulauf_seitlich' ---- 2740 intake_from_side +END +FROM qgep_od.manhole; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'normschacht' +FROM + sia405_abwasser_2015_2_d.normschacht a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.einleitstelle +( +t_id, hochwasserkote, relevanz, terrainkote, wasserspiegel_hydraulik) +SELECT sia405_abwasser_2015_2_d.tid_lookup('einleitstelle', obj_id), highwater_level, +CASE WHEN relevance = 5580 THEN 'gewaesserrelevant' ---- 5580 relevant_for_water_course +WHEN relevance = 5581 THEN 'nicht_gewaesserrelevant' ---- 5581 non_relevant_for_water_course +END, terrain_level, waterlevel_hydraulic +FROM qgep_od.discharge_point; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'einleitstelle' +FROM + sia405_abwasser_2015_2_d.einleitstelle a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.spezialbauwerk +( +t_id, bypass, notueberlauf, funktion, regenbecken_anordnung) +SELECT sia405_abwasser_2015_2_d.tid_lookup('spezialbauwerk', obj_id), +CASE WHEN bypass = 2682 THEN 'nicht_vorhanden' ---- 2682 inexistent +WHEN bypass = 3055 THEN 'unbekannt' ---- 3055 unknown +WHEN bypass = 2681 THEN 'vorhanden' ---- 2681 existent +END, +CASE WHEN emergency_spillway = 5866 THEN 'andere' ---- 5866 other +WHEN emergency_spillway = 5864 THEN 'inMischabwasserkanalisation' ---- 5864 in_combined_waste_water_drain +WHEN emergency_spillway = 5865 THEN 'inRegenabwasserkanalisation' ---- 5865 in_rain_waste_water_drain +WHEN emergency_spillway = 5863 THEN 'inSchmutzabwasserkanalisation' ---- 5863 in_waste_water_drain +WHEN emergency_spillway = 5878 THEN 'keiner' ---- 5878 none +WHEN emergency_spillway = 5867 THEN 'unbekannt' ---- 5867 unknown +END, +CASE WHEN function = 6397 THEN 'abflussloseGrube' ---- 6397 pit_without_drain +WHEN function = 245 THEN 'Absturzbauwerk' ---- 245 drop_structure +WHEN function = 6398 THEN 'Abwasserfaulraum' ---- 6398 hydrolizing_tank +WHEN function = 5371 THEN 'andere' ---- 5371 other +WHEN function = 386 THEN 'Be_Entlueftung' ---- 386 venting +WHEN function = 3234 THEN 'Duekerkammer' ---- 3234 inverse_syphon_chamber +WHEN function = 5091 THEN 'Duekeroberhaupt' ---- 5091 syphon_head +WHEN function = 6399 THEN 'Faulgrube' ---- 6399 septic_tank_two_chambers +WHEN function = 3348 THEN 'Gelaendemulde' ---- 3348 terrain_depression +WHEN function = 336 THEN 'Geschiebefang' ---- 336 bolders_bedload_catchement_dam +WHEN function = 5494 THEN 'Guellegrube' ---- 5494 cesspit +WHEN function = 6478 THEN 'Klaergrube' ---- 6478 septic_tank +WHEN function = 2998 THEN 'Kontrollschacht' ---- 2998 manhole +WHEN function = 2768 THEN 'Oelabscheider' ---- 2768 oil_separator +WHEN function = 246 THEN 'Pumpwerk' ---- 246 pump_station +WHEN function = 3673 THEN 'Regenbecken_Durchlaufbecken' ---- 3673 stormwater_tank_with_overflow +WHEN function = 3674 THEN 'Regenbecken_Fangbecken' ---- 3674 stormwater_tank_retaining_first_flush +WHEN function = 5574 THEN 'Regenbecken_Fangkanal' ---- 5574 stormwater_retaining_channel +WHEN function = 3675 THEN 'Regenbecken_Regenklaerbecken' ---- 3675 stormwater_sedimentation_tank +WHEN function = 3676 THEN 'Regenbecken_Regenrueckhaltebecken' ---- 3676 stormwater_retention_tank +WHEN function = 5575 THEN 'Regenbecken_Regenrueckhaltekanal' ---- 5575 stormwater_retention_channel +WHEN function = 5576 THEN 'Regenbecken_Stauraumkanal' ---- 5576 stormwater_storage_channel +WHEN function = 3677 THEN 'Regenbecken_Verbundbecken' ---- 3677 stormwater_composite_tank +WHEN function = 5372 THEN 'Regenueberlauf' ---- 5372 stormwater_overflow +WHEN function = 5373 THEN 'Schwimmstoffabscheider' ---- 5373 floating_material_separator +WHEN function = 383 THEN 'seitlicherZugang' ---- 383 side_access +WHEN function = 227 THEN 'Spuelschacht' ---- 227 jetting_manhole +WHEN function = 4799 THEN 'Trennbauwerk' ---- 4799 separating_structure +WHEN function = 3008 THEN 'unbekannt' ---- 3008 unknown +WHEN function = 2745 THEN 'Wirbelfallschacht' ---- 2745 vortex_manhole +END, +CASE WHEN stormwater_tank_arrangement = 4608 THEN 'Hauptschluss' ---- 4608 main_connection +WHEN stormwater_tank_arrangement = 4609 THEN 'Nebenschluss' ---- 4609 side_connection +WHEN stormwater_tank_arrangement = 4610 THEN 'unbekannt' ---- 4610 unknown +END +FROM qgep_od.special_structure; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'spezialbauwerk' +FROM + sia405_abwasser_2015_2_d.spezialbauwerk a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.versickerungsanlage +( +t_id, schluckvermoegen, maengel, dimension1, dimension2, gwdistanz, wirksameflaeche, notueberlauf, art, beschriftung, versickerungswasser, saugwagen, wasserdichtheit) +SELECT sia405_abwasser_2015_2_d.tid_lookup('versickerungsanlage', obj_id), absorption_capacity, +CASE WHEN defects = 5361 THEN 'keine' ---- 5361 none +WHEN defects = 3276 THEN 'unwesentliche' ---- 3276 marginal +WHEN defects = 3275 THEN 'wesentliche' ---- 3275 substantial +END, dimension1, dimension2, distance_to_aquifer, effective_area, +CASE WHEN emergency_spillway = 5365 THEN 'inMischwasserkanalisation' ---- 5365 in_combined_waste_water_drain +WHEN emergency_spillway = 3307 THEN 'inRegenwasserkanalisation' ---- 3307 in_rain_waste_water_drain +WHEN emergency_spillway = 3304 THEN 'inVorfluter' ---- 3304 in_water_body +WHEN emergency_spillway = 3303 THEN 'keiner' ---- 3303 none +WHEN emergency_spillway = 3305 THEN 'oberflaechlichausmuendend' ---- 3305 surface_discharge +WHEN emergency_spillway = 3308 THEN 'unbekannt' ---- 3308 unknown +END, +CASE WHEN kind = 3282 THEN 'andere_mit_Bodenpassage' ---- 3282 with_soil_passage +WHEN kind = 3285 THEN 'andere_ohne_Bodenpassage' ---- 3285 without_soil_passage +WHEN kind = 3279 THEN 'Flaechenfoermige_Versickerung' ---- 3279 surface_infiltration +WHEN kind = 277 THEN 'Kieskoerper' ---- 277 gravel_formation +WHEN kind = 3284 THEN 'Kombination_Schacht_Strang' ---- 3284 combination_manhole_pipe +WHEN kind = 3281 THEN 'MuldenRigolenversickerung' ---- 3281 swale_french_drain_infiltration +WHEN kind = 3087 THEN 'unbekannt' ---- 3087 unknown +WHEN kind = 3280 THEN 'Versickerung_ueber_die_Schulter' ---- 3280 percolation_over_the_shoulder +WHEN kind = 276 THEN 'Versickerungsbecken' ---- 276 infiltration_basin +WHEN kind = 278 THEN 'Versickerungsschacht' ---- 278 adsorbing_well +WHEN kind = 3283 THEN 'Versickerungsstrang_Galerie' ---- 3283 infiltration_pipe_sections_gallery +END, +CASE WHEN labeling = 5362 THEN 'beschriftet' ---- 5362 labeled +WHEN labeling = 5363 THEN 'nichtbeschriftet' ---- 5363 not_labeled +WHEN labeling = 5364 THEN 'unbekannt' ---- 5364 unknown +END, +CASE WHEN seepage_utilization = 274 THEN 'Regenabwasser' ---- 274 rain_water +WHEN seepage_utilization = 273 THEN 'Reinabwasser' ---- 273 clean_water +WHEN seepage_utilization = 5359 THEN 'unbekannt' ---- 5359 unknown +END, +CASE WHEN vehicle_access = 3289 THEN 'unbekannt' ---- 3289 unknown +WHEN vehicle_access = 3288 THEN 'unzugaenglich' ---- 3288 inaccessible +WHEN vehicle_access = 3287 THEN 'zugaenglich' ---- 3287 accessible +END, +CASE WHEN watertightness = 3295 THEN 'nichtwasserdicht' ---- 3295 not_watertight +WHEN watertightness = 5360 THEN 'unbekannt' ---- 5360 unknown +WHEN watertightness = 3294 THEN 'wasserdicht' ---- 3294 watertight +END +FROM qgep_od.infiltration_installation; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'versickerungsanlage' +FROM + sia405_abwasser_2015_2_d.versickerungsanlage a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.rohrprofil +( +t_id, hoehenbreitenverhaeltnis, bezeichnung, profiltyp, bemerkung) +SELECT sia405_abwasser_2015_2_d.tid_lookup('rohrprofil', obj_id), height_width_ratio, identifier, +CASE WHEN profile_type = 3351 THEN 'Eiprofil' ---- 3351 egg +WHEN profile_type = 3350 THEN 'Kreisprofil' ---- 3350 circle +WHEN profile_type = 3352 THEN 'Maulprofil' ---- 3352 mouth +WHEN profile_type = 3354 THEN 'offenes_Profil' ---- 3354 open +WHEN profile_type = 3353 THEN 'Rechteckprofil' ---- 3353 rectangular +WHEN profile_type = 3355 THEN 'Spezialprofil' ---- 3355 special +WHEN profile_type = 3357 THEN 'unbekannt' ---- 3357 unknown +END, remark +FROM qgep_od.pipe_profile; + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('rohrprofil', qgep_od.pipe_profile.obj_id), '0', a.identifier as dataowner, b.identifier as provider, pipe_profile.last_modification, sia405_abwasser_2015_2_d.tid_lookup('rohrprofil', qgep_od.pipe_profile.obj_id) +FROM qgep_od.pipe_profile + LEFT JOIN qgep_od.organisation as a ON pipe_profile.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON pipe_profile.fk_provider = b.obj_id; + +INSERT INTO sia405_abwasser_2015_2_d.abwassernetzelement +( +t_id, bezeichnung, bemerkung, abwasserbauwerkref) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwassernetzelement', obj_id), identifier, remark, sia405_abwasser_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure) +FROM qgep_od.wastewater_networkelement; + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwassernetzelement', qgep_od.wastewater_networkelement.obj_id), '0', a.identifier as dataowner, b.identifier as provider, wastewater_networkelement.last_modification, sia405_abwasser_2015_2_d.tid_lookup('abwassernetzelement', qgep_od.wastewater_networkelement.obj_id) +FROM qgep_od.wastewater_networkelement + LEFT JOIN qgep_od.organisation as a ON wastewater_networkelement.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON wastewater_networkelement.fk_provider = b.obj_id; + +INSERT INTO sia405_abwasser_2015_2_d.haltungspunkt +( +t_id, hoehengenauigkeit, bezeichnung, kote, auslaufform, lage_anschluss, bemerkung, lage, abwassernetzelementref) +SELECT sia405_abwasser_2015_2_d.tid_lookup('haltungspunkt', obj_id), +CASE WHEN elevation_accuracy = 3248 THEN 'groesser_6cm' ---- 3248 more_than_6cm +WHEN elevation_accuracy = 3245 THEN 'plusminus_1cm' ---- 3245 plusminus_1cm +WHEN elevation_accuracy = 3246 THEN 'plusminus_3cm' ---- 3246 plusminus_3cm +WHEN elevation_accuracy = 3247 THEN 'plusminus_6cm' ---- 3247 plusminus_6cm +WHEN elevation_accuracy = 5376 THEN 'unbekannt' ---- 5376 unknown +END, identifier, level, +CASE WHEN outlet_shape = 5374 THEN 'abgerundet' ---- 5374 round_edged +WHEN outlet_shape = 298 THEN 'blendenfoermig' ---- 298 orifice +WHEN outlet_shape = 3358 THEN 'keine_Querschnittsaenderung' ---- 3358 no_cross_section_change +WHEN outlet_shape = 286 THEN 'scharfkantig' ---- 286 sharp_edged +WHEN outlet_shape = 5375 THEN 'unbekannt' ---- 5375 unknown +END, position_of_connection, remark, +--situation_geometry, +ST_Force2D(situation_geometry), +sia405_abwasser_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement) +FROM qgep_od.reach_point; + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('haltungspunkt', qgep_od.reach_point.obj_id), '0', a.identifier as dataowner, b.identifier as provider, reach_point.last_modification, sia405_abwasser_2015_2_d.tid_lookup('haltungspunkt', qgep_od.reach_point.obj_id) +FROM qgep_od.reach_point + LEFT JOIN qgep_od.organisation as a ON reach_point.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON reach_point.fk_provider = b.obj_id; + +INSERT INTO sia405_abwasser_2015_2_d.abwasserknoten +( +t_id, rueckstaukote, sohlenkote, lage) +SELECT sia405_abwasser_2015_2_d.tid_lookup('abwasserknoten', obj_id), backflow_level, bottom_level, +--situation_geometry +ST_Force2D(situation_geometry) +FROM qgep_od.wastewater_node; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'abwasserknoten' +FROM + sia405_abwasser_2015_2_d.abwasserknoten a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.haltung +( +t_id, lichte_hoehe, reibungsbeiwert, lagebestimmung, innenschutz, laengeeffektiv, material, verlauf, reliner_material, reliner_nennweite, reliner_bautechnik, reliner_art, ringsteifigkeit, plangefaelle, wandrauhigkeit, vonhaltungspunktref, nachhaltungspunktref, rohrprofilref) +SELECT sia405_abwasser_2015_2_d.tid_lookup('haltung', obj_id), clear_height, coefficient_of_friction, +CASE WHEN horizontal_positioning = 5378 THEN 'genau' ---- 5378 accurate +WHEN horizontal_positioning = 5379 THEN 'unbekannt' ---- 5379 unknown +WHEN horizontal_positioning = 5380 THEN 'ungenau' ---- 5380 inaccurate +END, +CASE WHEN inside_coating = 5383 THEN 'andere' ---- 5383 other +WHEN inside_coating = 248 THEN 'Anstrich_Beschichtung' ---- 248 coating +WHEN inside_coating = 250 THEN 'Kanalklinkerauskleidung' ---- 250 brick_lining +WHEN inside_coating = 251 THEN 'Steinzeugauskleidung' ---- 251 stoneware_lining +WHEN inside_coating = 5384 THEN 'unbekannt' ---- 5384 unknown +WHEN inside_coating = 249 THEN 'Zementmoertelauskleidung' ---- 249 cement_mortar_lining +END, length_effective, +CASE WHEN material = 5381 THEN 'andere' ---- 5381 other +WHEN material = 2754 THEN 'Asbestzement' ---- 2754 asbestos_cement +WHEN material = 3638 THEN 'Beton_Normalbeton' ---- 3638 concrete_normal +WHEN material = 3639 THEN 'Beton_Ortsbeton' ---- 3639 concrete_insitu +WHEN material = 3640 THEN 'Beton_Pressrohrbeton' ---- 3640 concrete_presspipe +WHEN material = 3641 THEN 'Beton_Spezialbeton' ---- 3641 concrete_special +WHEN material = 3256 THEN 'Beton_unbekannt' ---- 3256 concrete_unknown +WHEN material = 147 THEN 'Faserzement' ---- 147 fiber_cement +WHEN material = 2755 THEN 'Gebrannte_Steine' ---- 2755 bricks +WHEN material = 148 THEN 'Guss_duktil' ---- 148 cast_ductile_iron +WHEN material = 3648 THEN 'Guss_Grauguss' ---- 3648 cast_gray_iron +WHEN material = 5076 THEN 'Kunststoff_Epoxydharz' ---- 5076 plastic_epoxy_resin +WHEN material = 5077 THEN 'Kunststoff_Hartpolyethylen' ---- 5077 plastic_highdensity_polyethylene +WHEN material = 5078 THEN 'Kunststoff_Polyester_GUP' ---- 5078 plastic_polyester_GUP +WHEN material = 5079 THEN 'Kunststoff_Polyethylen' ---- 5079 plastic_polyethylene +WHEN material = 5080 THEN 'Kunststoff_Polypropylen' ---- 5080 plastic_polypropylene +WHEN material = 5081 THEN 'Kunststoff_Polyvinilchlorid' ---- 5081 plastic_PVC +WHEN material = 5382 THEN 'Kunststoff_unbekannt' ---- 5382 plastic_unknown +WHEN material = 153 THEN 'Stahl' ---- 153 steel +WHEN material = 3654 THEN 'Stahl_rostfrei' ---- 3654 steel_stainless +WHEN material = 154 THEN 'Steinzeug' ---- 154 stoneware +WHEN material = 2761 THEN 'Ton' ---- 2761 clay +WHEN material = 3016 THEN 'unbekannt' ---- 3016 unknown +WHEN material = 2762 THEN 'Zement' ---- 2762 cement +END, +--progression_geometry, +ST_Force2D(progression_geometry), +CASE WHEN reliner_material = 6459 THEN 'andere' ---- 6459 other +WHEN reliner_material = 6461 THEN 'Epoxidharz_Glasfaserlaminat' ---- 6461 epoxy_resin_glass_fibre_laminate +WHEN reliner_material = 6460 THEN 'Epoxidharz_Kunststofffilz' ---- 6460 epoxy_resin_plastic_felt +WHEN reliner_material = 6483 THEN 'GUP_Rohr' ---- 6483 GUP_pipe +WHEN reliner_material = 6462 THEN 'HDPE' ---- 6462 HDPE +WHEN reliner_material = 6484 THEN 'Isocyanatharze_Glasfaserlaminat' ---- 6484 isocyanate_resin_glass_fibre_laminate +WHEN reliner_material = 6485 THEN 'Isocyanatharze_Kunststofffilz' ---- 6485 isocyanate_resin_plastic_felt +WHEN reliner_material = 6464 THEN 'Polyesterharz_Glasfaserlaminat' ---- 6464 polyester_resin_glass_fibre_laminate +WHEN reliner_material = 6463 THEN 'Polyesterharz_Kunststofffilz' ---- 6463 polyester_resin_plastic_felt +WHEN reliner_material = 6482 THEN 'Polypropylen' ---- 6482 polypropylene +WHEN reliner_material = 6465 THEN 'Polyvinilchlorid' ---- 6465 PVC +WHEN reliner_material = 6466 THEN 'Sohle_mit_Schale_aus_Polyesterbeton' ---- 6466 bottom_with_polyester_concret_shell +WHEN reliner_material = 6467 THEN 'unbekannt' ---- 6467 unknown +WHEN reliner_material = 6486 THEN 'UP_Harz_LED_Synthesefaserliner' ---- 6486 UP_resin_LED_synthetic_fibre_liner +WHEN reliner_material = 6468 THEN 'Vinylesterharz_Glasfaserlaminat' ---- 6468 vinyl_ester_resin_glass_fibre_laminate +WHEN reliner_material = 6469 THEN 'Vinylesterharz_Kunststofffilz' ---- 6469 vinyl_ester_resin_plastic_felt +END, reliner_nominal_size, +CASE WHEN relining_construction = 6448 THEN 'andere' ---- 6448 other +WHEN relining_construction = 6479 THEN 'Close_Fit_Relining' ---- 6479 close_fit_relining +WHEN relining_construction = 6449 THEN 'Kurzrohrrelining' ---- 6449 relining_short_tube +WHEN relining_construction = 6481 THEN 'Noppenschlauchrelining' ---- 6481 grouted_in_place_lining +WHEN relining_construction = 6452 THEN 'Partieller_Liner' ---- 6452 partial_liner +WHEN relining_construction = 6450 THEN 'Rohrstrangrelining' ---- 6450 pipe_string_relining +WHEN relining_construction = 6451 THEN 'Schlauchrelining' ---- 6451 hose_relining +WHEN relining_construction = 6453 THEN 'unbekannt' ---- 6453 unknown +WHEN relining_construction = 6480 THEN 'Wickelrohrrelining' ---- 6480 spiral_lining +END, +CASE WHEN relining_kind = 6455 THEN 'ganze_Haltung' ---- 6455 full_reach +WHEN relining_kind = 6456 THEN 'partiell' ---- 6456 partial +WHEN relining_kind = 6457 THEN 'unbekannt' ---- 6457 unknown +END, ring_stiffness, slope_building_plan, wall_roughness, sia405_abwasser_2015_2_d.tid_lookup('Haltungspunkt', fk_reach_point_from), sia405_abwasser_2015_2_d.tid_lookup('Haltungspunkt', fk_reach_point_to), sia405_abwasser_2015_2_d.tid_lookup('Rohrprofil', fk_pipe_profile) +FROM qgep_od.reach; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'haltung' +FROM + sia405_abwasser_2015_2_d.haltung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.bauwerksteil +( +t_id, bezeichnung, bemerkung, instandstellung, abwasserbauwerkref) +SELECT sia405_abwasser_2015_2_d.tid_lookup('bauwerksteil', obj_id), identifier, remark, +CASE WHEN renovation_demand = 138 THEN 'nicht_notwendig' ---- 138 not_necessary +WHEN renovation_demand = 137 THEN 'notwendig' ---- 137 necessary +WHEN renovation_demand = 5358 THEN 'unbekannt' ---- 5358 unknown +END, sia405_abwasser_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure) +FROM qgep_od.structure_part; + +INSERT INTO sia405_abwasser_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT sia405_abwasser_2015_2_d.tid_lookup('bauwerksteil', qgep_od.structure_part.obj_id), '0', a.identifier as dataowner, b.identifier as provider, structure_part.last_modification, sia405_abwasser_2015_2_d.tid_lookup('bauwerksteil', qgep_od.structure_part.obj_id) +FROM qgep_od.structure_part + LEFT JOIN qgep_od.organisation as a ON structure_part.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON structure_part.fk_provider = b.obj_id; + +INSERT INTO sia405_abwasser_2015_2_d.trockenwetterfallrohr +( +t_id, durchmesser) +SELECT sia405_abwasser_2015_2_d.tid_lookup('trockenwetterfallrohr', obj_id), diameter +FROM qgep_od.dryweather_downspout; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'trockenwetterfallrohr' +FROM + sia405_abwasser_2015_2_d.trockenwetterfallrohr a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.einstiegshilfe +( +t_id, art) +SELECT sia405_abwasser_2015_2_d.tid_lookup('einstiegshilfe', obj_id), +CASE WHEN kind = 5357 THEN 'andere' ---- 5357 other +WHEN kind = 243 THEN 'Drucktuere' ---- 243 pressurized_door +WHEN kind = 92 THEN 'keine' ---- 92 none +WHEN kind = 240 THEN 'Leiter' ---- 240 ladder +WHEN kind = 241 THEN 'Steigeisen' ---- 241 step_iron +WHEN kind = 3473 THEN 'Treppe' ---- 3473 staircase +WHEN kind = 91 THEN 'Trittnischen' ---- 91 footstep_niches +WHEN kind = 3230 THEN 'Tuere' ---- 3230 door +WHEN kind = 3048 THEN 'unbekannt' ---- 3048 unknown +END +FROM qgep_od.access_aid; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'einstiegshilfe' +FROM + sia405_abwasser_2015_2_d.einstiegshilfe a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.trockenwetterrinne +( +t_id, material) +SELECT sia405_abwasser_2015_2_d.tid_lookup('trockenwetterrinne', obj_id), +CASE WHEN material = 3221 THEN 'andere' ---- 3221 other +WHEN material = 354 THEN 'kombiniert' ---- 354 combined +WHEN material = 5356 THEN 'Kunststoff' ---- 5356 plastic +WHEN material = 238 THEN 'Steinzeug' ---- 238 stoneware +WHEN material = 3017 THEN 'unbekannt' ---- 3017 unknown +WHEN material = 237 THEN 'Zementmoertel' ---- 237 cement_mortar +END +FROM qgep_od.dryweather_flume; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'trockenwetterrinne' +FROM + sia405_abwasser_2015_2_d.trockenwetterrinne a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.deckel +( +t_id, fabrikat, deckelform, durchmesser, verschluss, kote, material, lagegenauigkeit, lage, schlammeimer, entlueftung) +SELECT sia405_abwasser_2015_2_d.tid_lookup('deckel', obj_id), brand, +CASE WHEN cover_shape = 5353 THEN 'andere' ---- 5353 other +WHEN cover_shape = 3499 THEN 'eckig' ---- 3499 rectangular +WHEN cover_shape = 3498 THEN 'rund' ---- 3498 round +WHEN cover_shape = 5354 THEN 'unbekannt' ---- 5354 unknown +END, diameter, +CASE WHEN fastening = 5350 THEN 'nicht_verschraubt' ---- 5350 not_bolted +WHEN fastening = 5351 THEN 'unbekannt' ---- 5351 unknown +WHEN fastening = 5352 THEN 'verschraubt' ---- 5352 bolted +END, level, +CASE WHEN material = 5355 THEN 'andere' ---- 5355 other +WHEN material = 234 THEN 'Beton' ---- 234 concrete +WHEN material = 233 THEN 'Guss' ---- 233 cast_iron +WHEN material = 5547 THEN 'Guss_mit_Belagsfuellung' ---- 5547 cast_iron_with_pavement_filling +WHEN material = 235 THEN 'Guss_mit_Betonfuellung' ---- 235 cast_iron_with_concrete_filling +WHEN material = 3015 THEN 'unbekannt' ---- 3015 unknown +END, +CASE WHEN positional_accuracy = 3243 THEN 'groesser_50cm' ---- 3243 more_than_50cm +WHEN positional_accuracy = 3241 THEN 'plusminus_10cm' ---- 3241 plusminus_10cm +WHEN positional_accuracy = 3236 THEN 'plusminus_3cm' ---- 3236 plusminus_3cm +WHEN positional_accuracy = 3242 THEN 'plusminus_50cm' ---- 3242 plusminus_50cm +WHEN positional_accuracy = 5349 THEN 'unbekannt' ---- 5349 unknown +END, +--situation_geometry, +ST_Force2D(situation_geometry), +CASE WHEN sludge_bucket = 423 THEN 'nicht_vorhanden' ---- 423 inexistent +WHEN sludge_bucket = 3066 THEN 'unbekannt' ---- 3066 unknown +WHEN sludge_bucket = 422 THEN 'vorhanden' ---- 422 existent +END, +CASE WHEN venting = 229 THEN 'entlueftet' ---- 229 vented +WHEN venting = 230 THEN 'nicht_entlueftet' ---- 230 not_vented +WHEN venting = 5348 THEN 'unbekannt' ---- 5348 unknown +END +FROM qgep_od.cover; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'deckel' +FROM + sia405_abwasser_2015_2_d.deckel a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO sia405_abwasser_2015_2_d.bankett +( +t_id, art) +SELECT sia405_abwasser_2015_2_d.tid_lookup('bankett', obj_id), +CASE WHEN kind = 5319 THEN 'andere' ---- 5319 other +WHEN kind = 94 THEN 'beidseitig' ---- 94 double_sided +WHEN kind = 93 THEN 'einseitig' ---- 93 one_sided +WHEN kind = 3231 THEN 'kein' ---- 3231 none +WHEN kind = 3033 THEN 'unbekannt' ---- 3033 unknown +END +FROM qgep_od.benching; + +UPDATE sia405_abwasser_2015_2_d.baseclass SET t_type = 'bankett' +FROM + sia405_abwasser_2015_2_d.bankett a +WHERE + baseclass.t_id = a.t_id; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/create_sia405_abwasser_2015_2_d.count_element_sia405_abwasser.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/create_sia405_abwasser_2015_2_d.count_element_sia405_abwasser.sql new file mode 100644 index 00000000..2e7a8a32 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/create_sia405_abwasser_2015_2_d.count_element_sia405_abwasser.sql @@ -0,0 +1,83 @@ +-- function for counting number of object in tables (german classnames) +-- 13.7.2019 sjib +-- SELECT sia405_abwasser_2015_2_d.count_elements(); +CREATE OR REPLACE FUNCTION sia405_abwasser_2015_2_d.count_elements() + RETURNS text AS +$BODY$ +DECLARE + table_elements text; + list text; + +BEGIN + +list = 'List of elements in tables: '; +list = list || 'organisation: '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.organisation; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk (wastewater_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.abwasserbauwerk; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk_text (wastewater_structure_text): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.abwasserbauwerk_text; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk_symbol (wastewater_structure_symbol): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.abwasserbauwerk_symbol; +list = list || table_elements || ', '; +list = list || 'kanal (channel): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.kanal; +list = list || table_elements || ', '; +list = list || 'nomschacht (manhole): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.normschacht; +list = list || table_elements || ', '; +list = list || 'einleitstelle (discharge_point): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.einleitstelle; +list = list || table_elements || ', '; +list = list || 'spezialbauwerk (special_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.spezialbauwerk; +list = list || table_elements || ', '; +list = list || 'versickerungsanlage (infiltration_installation): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.versickerungsanlage; +list = list || table_elements || ', '; +list = list || 'rohrprofil (pipe_profile): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.rohrprofil; +list = list || table_elements || ', '; +list = list || 'abwassernetzelement (wastewater_networkelement): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.abwassernetzelement; +list = list || table_elements || ', '; +list = list || 'haltungspunkt (reach_point): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.haltungspunkt; +list = list || table_elements || ', '; +list = list || 'abwasserknoten (wastewater_node): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.abwasserknoten; +list = list || table_elements || ', '; +list = list || 'haltung (reach): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.haltung; +list = list || table_elements || ', '; +list = list || 'haltung_text (reach_text): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.haltung_text; +list = list || table_elements || ', '; +list = list || 'bauwerksteil (structure_part): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.bauwerksteil; +list = list || table_elements || ', '; +list = list || 'trockenwetterfallrohr (dryweather_downspout): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.trockenwetterfallrohr; +list = list || table_elements || ', '; +list = list || 'einstiegshilfe (access_aid): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.einstiegshilfe; +list = list || table_elements || ', '; +list = list || 'trockenwetterrinne (dryweather_flume): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.trockenwetterrinne; +list = list || table_elements || ', '; +list = list || 'deckel (cover): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.deckel; +list = list || table_elements || ', '; +list = list || 'bankett (benching): '; +SELECT COUNT(t_id) INTO table_elements FROM sia405_abwasser_2015_2_d.bankett; +list = list || table_elements || ', '; + +RETURN list; + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/create_vsa_dss_2015_2_d.count_element_vsa_dss_2015.sql b/docs/stefans_scripts/export/sia405_abwasser_2015/create_vsa_dss_2015_2_d.count_element_vsa_dss_2015.sql new file mode 100644 index 00000000..7afd31e9 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/create_vsa_dss_2015_2_d.count_element_vsa_dss_2015.sql @@ -0,0 +1,270 @@ +-- function for counting number of object in tables (german classnames) +-- 13.7.2019 sjib / in Bearbeitung 21.10.2020 + +-- to execute afterwards +-- SELECT vsa_dss_2015_2_d_3122.count_elements(); + + +CREATE OR REPLACE FUNCTION vsa_dss_2015_2_d_3122.count_elements() + RETURNS text AS +$BODY$ +DECLARE + table_elements text; +-- table_elements_organisation text; + list text; + check_structure_parts integer; + check_organisations integer; + check_wastewater_networkelements integer; + check_wastewater_structures integer; + structure_parts integer; + organisations integer; + wastewater_networkelements integer; + wastewater_structures integer; + +BEGIN + +list = 'List of elements in tables: ,'; + +-- organisation und subklassen + +list = list || 'organisation: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.organisation; +list = list || table_elements || ', '; + +-- anzahl einträge bauwerksteil auf structure_parts schreiben +organisations = table_elements::integer; +-- totalanzahl auf check_structure_parts kopieren +check_organisations = organisations; + + +list = list || 'amt: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.amt; +list = list || table_elements || ', '; + +-- anzahl amt abziehen +check_organisations = check_organisations - table_elements::integer; + +list = list || 'abwasserverband: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwasserverband; +list = list || table_elements || ', '; + +-- anzahl amt abziehen +check_organisations = check_organisations - table_elements::integer; + +list = list || 'gemeinde: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.gemeinde; +list = list || table_elements || ', '; + +-- anzahl gemeinde abziehen +check_organisations = check_organisations - table_elements::integer; + +list = list || 'kanton: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.kanton; +list = list || table_elements || ', '; + +-- anzahl kanton abziehen +check_organisations = check_organisations - table_elements::integer; + + +list = list || 'genossenschaft_korporation: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.genossenschaft_korporation; +list = list || table_elements || ', '; + +-- anzahl genossenschaft_korporation abziehen +check_organisations = check_organisations - table_elements::integer; + +list = list || 'privat: '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.privat; +list = list || table_elements || ', '; + +-- anzahl privat abziehen +check_organisations = check_organisations - table_elements::integer; + + +-- falls null ist gut, sonst +IF check_organisations <> 0 THEN + list = list || 'ERROR: number of subclass elements of organisations NOT CORRECT in schema vsa_dss_2015_2_d_3122: checksum = ' || check_organisations || ', '; +ELSE + list = list || ' - OK: number of subclass elements of organisations OK in schema vsa_dss_2015_2_d_3122!' || ', '; +END IF; + + +-- abwasserbauwerk und subklassen + +list = list || 'abwasserbauwerk (wastewater_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwasserbauwerk; +list = list || table_elements || ', '; + +-- anzahl einträge bauwerksteil auf structure_parts schreiben +wastewater_structures = table_elements::integer; +-- totalanzahl auf check_structure_parts kopieren +check_wastewater_structures = wastewater_structures; + + +list = list || 'abwasserbauwerk_text (wastewater_structure_text): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwasserbauwerk_text; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk_symbol (wastewater_structure_symbol): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwasserbauwerk_symbol; +list = list || table_elements || ', '; + +list = list || 'kanal (channel): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.kanal; +list = list || table_elements || ', '; + +-- anzahl kanal abziehen +check_wastewater_structures = check_wastewater_structures - table_elements::integer; + +list = list || 'nomschacht (manhole): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.normschacht; +list = list || table_elements || ', '; + +-- anzahl nomschacht abziehen +check_wastewater_structures = check_wastewater_structures - table_elements::integer; + + +list = list || 'einleitstelle (discharge_point): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.einleitstelle; +list = list || table_elements || ', '; + +-- anzahl einleitstelle abziehen +check_wastewater_structures = check_wastewater_structures - table_elements::integer; + + +list = list || 'spezialbauwerk (special_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.spezialbauwerk; +list = list || table_elements || ', '; + +-- anzahl spezialbauwerk abziehen +check_wastewater_structures = check_wastewater_structures - table_elements::integer; + + +list = list || 'versickerungsanlage (infiltration_installation): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.versickerungsanlage; +list = list || table_elements || ', '; + + +-- anzahl versickerungsanlage abziehen +check_wastewater_structures = check_wastewater_structures - table_elements::integer; + +-- falls null ist gut, sonst +IF check_wastewater_structures <> 0 THEN + list = list || 'ERROR: number of subclass elements of wastewater_structures NOT CORRECT in schmea vsa_dss_2015_2_d_3122: checksum = ' || check_wastewater_structures || ', '; +ELSE + list = list || ' OK: number of subclass elements of wastewater_structures OK in schema vsa_dss_2015_2_d_3122!' || ', '; +END IF; + + +-- rohrprofil +list = list || 'rohrprofil (pipe_profile): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.rohrprofil; +list = list || table_elements || ', '; + + + +-- abwassernetzelemente und subklassen +list = list || 'abwassernetzelement (wastewater_networkelement): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwassernetzelement; +list = list || table_elements || ', '; + +-- anzahl einträge abwassernetzelement auf check_wastewater_networkelements schreiben +wastewater_networkelements = table_elements::integer; +-- totalanzahl auf check_wastewater_networkelements kopieren +check_wastewater_networkelements = wastewater_networkelements; + +list = list || 'abwasserknoten (wastewater_node): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.abwasserknoten; +list = list || table_elements || ', '; + +-- anzahl abwasserknoten abziehen +check_wastewater_networkelements = check_wastewater_networkelements - table_elements::integer; + + +list = list || 'haltung (reach): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.haltung; +list = list || table_elements || ', '; + +-- anzahl haltung abziehen +check_wastewater_networkelements = check_wastewater_networkelements - table_elements::integer; + + +list = list || 'haltung_text (reach_text): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.haltung_text; +list = list || table_elements || ', '; + +-- falls null ist gut, sonst +IF check_wastewater_networkelements <> 0 THEN + list = list || 'ERROR: number of subclass elements of wastewater_networkelements NOT CORRECT in schmea vsa_dss_2015_2_d_3122: checksum = ' || check_wastewater_networkelements || ', '; +ELSE + list = list || ' OK: number of subclass elements of wastewater_networkelements OK in schema vsa_dss_2015_2_d_3122!' || ', '; +END IF; + + +-- haltungspunkte +list = list || 'haltungspunkt (reach_point): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.haltungspunkt; +list = list || table_elements || ', '; + + + +-- bauwerksteil und subklassen +list = list || 'bauwerksteil (structure_part): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.bauwerksteil; +list = list || table_elements || ', '; + +-- anzahl einträge bauwerksteil auf structure_parts schreiben +structure_parts = table_elements::integer; +-- totalanzahl auf check_structure_parts kopieren +check_structure_parts = structure_parts; + +list = list || 'trockenwetterfallrohr (dryweather_downspout): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.trockenwetterfallrohr; +list = list || table_elements || ', '; + +-- anzahl trockenwetterfallrohr abziehen +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'einstiegshilfe (access_aid): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.einstiegshilfe; +list = list || table_elements || ', '; + +-- anzahl einstiegshilfe abziehen +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'trockenwetterrinne (dryweather_flume): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.trockenwetterrinne; +list = list || table_elements || ', '; + +-- anzahl trockenwetterrinne abziehen +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'deckel (cover): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.deckel; +list = list || table_elements || ', '; + +-- anzahl deckel abziehen +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'bankett (benching): '; +SELECT COUNT(t_id) INTO table_elements FROM vsa_dss_2015_2_d_3122.bankett; +list = list || table_elements || ', '; + +-- anzahl bankett abziehen +check_structure_parts = check_structure_parts - table_elements::integer; + +-- falls null ist gut, sonst +IF check_structure_parts <> 0 THEN + list = list || 'ERROR: number of subclass elements of structure parts NOT CORRECT in schmea vsa_dss_2015_2_d_3122: checksum = ' || check_structure_parts || ', '; +ELSE + list = list || ' OK: number of subclass elements of structure parts OK in schema vsa_dss_2015_2_d_3122!' || ', '; +END IF; + + + + +RETURN list; + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/e1_createexportschema_sia405_abwasser_2015_2_d.bat b/docs/stefans_scripts/export/sia405_abwasser_2015/e1_createexportschema_sia405_abwasser_2015_2_d.bat new file mode 100644 index 00000000..0c200806 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/e1_createexportschema_sia405_abwasser_2015_2_d.bat @@ -0,0 +1,8 @@ +rem pause +rem --defaultSrsAuth EPSG --defaultSrsCode 2056 ergänzt 12.7.2019 +rem -- Korrekturen Organisation schon im xtf: abwa_2015neumod.xtf + +rem set variable to ili2pg*.jar, dbdatabase, dbpwd, ilipath etc. + +java -jar ../ili2pg-3.12.2.jar --createEnumTxtCol --schemaimport --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --defaultSrsAuth EPSG --defaultSrsCode 2056 --dbhost localhost --dbport 5434 --dbdatabase qgep_prod --dbschema sia405_abwasser_2015_2 --dbusr postgres --dbpwd sjib --log createschema_sia405_abwasser_2015_2.log --trace SIA405_ABWASSER_2015.ili +pause diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/e2_exportschema_anpassungen_sia405_abwasser_2015_2_d.bat b/docs/stefans_scripts/export/sia405_abwasser_2015/e2_exportschema_anpassungen_sia405_abwasser_2015_2_d.bat new file mode 100644 index 00000000..0c81f147 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/e2_exportschema_anpassungen_sia405_abwasser_2015_2_d.bat @@ -0,0 +1,28 @@ +rem choose your database name +set db=qgep_prod +adapt port of your database +set port=5434 +rem adapt postgres path to your system +set PATH=%PATH%;C:\Program Files\PostgreSQL\9.6\bin + +rem db erzeugen +rem createdb -U postgres -p %port% %db% +psql -U postgres -h localhost -p %port% -d %db% -f 01_sia405_abwasser_2015_2_d_tid_generate.sql> 01_tid_generate.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 02_sia405_abwasser_2015_2_d_tid_lookup.sql> 02_tid_lookup.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 046_sia405_abwasser_2015_2_d_t_key_object_insert_metadata.sql> 046_t_key_object_insert_metadata.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 050_sia405_abwasser_2015_2.vw_sia405_baseclass_metattribute.sql> 050_vw_sia405_baseclass_metattribute.log 2>&1 +PAUSE + +-- rem neu 12.7.2019 +psql -U postgres -h localhost -p %port% -d %db% -f sia405_abwasser_2015_2_d.vw_organisation.sql> sia405_abwasser_2015_2_d.vw_organisation.log 2>&1 +PAUSE + +rem neu 15.8.2019 +psql -U postgres -h localhost -p %port% -d %db% -f 022_sia405_abwasser_2015_2_d_basket_update.sql > 022_sia405_abwasser_2015_2_d_basket_update.log 2>&1 +PAUSE diff --git a/docs/stefans_scripts/export/sia405_abwasser_2015/e3_datenexport_sia405_abwasser_2015_2_d_nosmart.bat b/docs/stefans_scripts/export/sia405_abwasser_2015/e3_datenexport_sia405_abwasser_2015_2_d_nosmart.bat new file mode 100644 index 00000000..0fc74408 --- /dev/null +++ b/docs/stefans_scripts/export/sia405_abwasser_2015/e3_datenexport_sia405_abwasser_2015_2_d_nosmart.bat @@ -0,0 +1,10 @@ +rem bat and sql in the same directory +rem set PATH=%PATH%;C:\Program Files\PostgreSQL\9.6\bin +rem base: psql -h %localhost% -p 5432 -U %postgres% -d %qgep% -f 'xy.sql' +rem works for database "qgepe" on localhost + +rem add variables dbport, dbdatabase, output file name dbpwd, models + +java -jar ../ili2pg-3.12.2.jar --export --trace --log sia_405_abwasser_2015_2_d_exp.log --models SIA405_ABWASSER_2015_LV95 --noSmartMapping --defaultSrsAuth EPSG --defaultSrsCode 2056 --dbhost localhost --dbport 5434 --dbdatabase qgep_prod --dbschema sia405_abwasser_2015_2_d --dbusr postgres --dbpwd sjib sia_405_abwasser_2015_2_d_flue.xtf +pause +rem takes xx sec diff --git a/docs/stefans_scripts/export/vsa_dss_2015/01_vsa_dss_2015_2_d_tid_generate.sql b/docs/stefans_scripts/export/vsa_dss_2015/01_vsa_dss_2015_2_d_tid_generate.sql new file mode 100644 index 00000000..aa765c43 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/01_vsa_dss_2015_2_d_tid_generate.sql @@ -0,0 +1,53 @@ +-- this file generates a new SQL function to create TIDs for all the tables of the import/export schema with ili2pg. +-- you need to set the current maxvalue of the TID into the schema.table.field vsa_dss_2015_2_d.t_key_object.t_lastuniqueid +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_generate.sql +-- schema für export heisst vsa_dss_2015_2_304 + + +-- function for generating TIDs +CREATE OR REPLACE FUNCTION vsa_dss_2015_2_d.tid_generate(table_name text, obj_id_table text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + nexttid integer; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('vsa_dss_2015_2_d.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + -- 23.12.2015 SELECT t_lastuniqueid FROM vsa_dss_2015_2_d.t_key_object AS nexttid; + SELECT t_lastuniqueid INTO nexttid FROM vsa_dss_2015_2_d.t_key_object; + newtid = (nexttid + 1); + + -- 12.1.2016 + RAISE NOTICE 'newtid is %', newtid; -- Print newtid + RAISE NOTICE 'nexttid is %', nexttid; -- Print nexttid + + -- adapt t_lastuniqueid in t_key_object + UPDATE vsa_dss_2015_2_d.t_key_object + SET t_lastuniqueid = newtid + , t_user = current_user + , t_createdate = current_timestamp + WHERE t_lastuniqueid = nexttid; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table % not found', table_name; + ELSE + RAISE NOTICE 't_key_object updated'; + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN newtid; + + + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/021_vsa_dss_2015_2_d_create_seq_ili2db.sql b/docs/stefans_scripts/export/vsa_dss_2015/021_vsa_dss_2015_2_d_create_seq_ili2db.sql new file mode 100644 index 00000000..6102d262 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/021_vsa_dss_2015_2_d_create_seq_ili2db.sql @@ -0,0 +1,16 @@ +-- neu 22.11.2016 fehlt mit --createscript in schema + +-- Schema: vsa_dss_2015_2_d. + +-- DROP SCHEMA vsa_dss_2015_2_304 CASCADE; + +CREATE SEQUENCE vsa_dss_2015_2_d.t_ili2db_seq +increment 1 +minValue 1 +maxValue 9223372036854775807 +start 1 +cache 1; + + +ALTER TABLE vsa_dss_2015_2_d.t_ili2db_seq + OWNER TO postgres; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/022_vsa_dss_2015_2_d_basket_update.sql b/docs/stefans_scripts/export/vsa_dss_2015/022_vsa_dss_2015_2_d_basket_update.sql new file mode 100644 index 00000000..7ad01ac1 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/022_vsa_dss_2015_2_d_basket_update.sql @@ -0,0 +1,51 @@ +-- neu 26.11.2016 Stefan Burckhardt / 4.7.2017 corrected +-- Updates data in vsa_dss_2015_2_d.t_ili2db_import_basket with last tid from t_key_object + +-- Function: vsa_dss_2015_2_d.basket_update() + +-- DROP FUNCTION vsa_dss_2015_2_d.basket_update(); + +CREATE OR REPLACE FUNCTION vsa_dss_2015_2_d.basket_update() + RETURNS integer AS +$BODY$ +DECLARE + lasttid integer; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('sia405_abwasser_2015_2_d_301.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + + SELECT t_lastuniqueid INTO lasttid FROM vsa_dss_2015_2_d.t_key_object; + + + -- 25.11.2016 + RAISE NOTICE '[basket_update]: lasttid is %', lasttid; -- Print lasttid + + + -- adapt t_lastuniqueid in t_key_object + UPDATE vsa_dss_2015_2_d.t_ili2db_import_basket + SET t_id = lasttid + 1 + , end_t_id = lasttid + , objectcount = lasttid - 2 + WHERE import = 2; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table basket_update not found - first data will be inserte'; + INSERT INTO vsa_dss_2015_d_391.t_ili2db_import_basket (t_id, import, basket, objectcount, start_t_id, end_t_id) VALUES (lasttid + 1, 2, 3, lasttid - 2, 3, lasttid); + + ELSE + RAISE NOTICE 't_ili2db_import_basket updated %', lasttid; + -- SELECT setval (sia405_abwasser_2015_2_d_340.t_ili2db_seq, lasttid + 1); + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN lasttid; + + + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; +ALTER FUNCTION vsa_dss_2015_2_d.basket_update() + OWNER TO postgres; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/02_vsa_dss_2015_2_d_tid_lookup.sql b/docs/stefans_scripts/export/vsa_dss_2015/02_vsa_dss_2015_2_d_tid_lookup.sql new file mode 100644 index 00000000..f14b37ca --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/02_vsa_dss_2015_2_d_tid_lookup.sql @@ -0,0 +1,51 @@ +-- this file looks up the t_id for foreignkeys (OID) for the tables of the import/export schema with ili2pg. +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_lookup.sql +-- schema für export heisst vsa_dss_2015_2_d. +-- last update 18.11.2016 Stefan Burckhardt + +-- function for looking up t_id +CREATE OR REPLACE FUNCTION vsa_dss_2015_2_d.tid_lookup(table_name text, obj_id_ref text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + tid_ref integer; + -- newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + -- 9.3.2016 check whether obj_id_ref NOT IS NULL + IF obj_id_ref IS NULL THEN + tid_ref = NULL; + RAISE NOTICE '[tid_lookup]: obj_id is NULL . tid_ref set NULL also'; -- Print newtid + ELSE + -- get tid_ref for foreignkey + -- SELECT t_id INTO tid_ref FROM vsa_dss_2015_2_d.baseclass WHERE t_ili_tid = 'ch13p7mzOG000002'; + SELECT t_id INTO tid_ref FROM vsa_dss_2015_2_d.baseclass WHERE t_ili_tid = obj_id_ref; + + IF NOT FOUND THEN + -- 13.2.2016 / 9.3.2016 improved error message + -- RAISE EXCEPTION 'tid_ref for table % not found', table_name; + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref for table % not found', table_name; + RAISE EXCEPTION 'Missing t_id in table baseclass'; + + ELSE + -- 12.1.2016 + -- 13.2.2016 comment out to speed up + -- 9.3.2016 Hineis ergänzt mit OBJ_ID + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref is %', tid_ref; + + END IF; + END IF; + + RETURN tid_ref; + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/046_vsa_dss_2015_2_d_t_key_object_insert_metadata.sql b/docs/stefans_scripts/export/vsa_dss_2015/046_vsa_dss_2015_2_d_t_key_object_insert_metadata.sql new file mode 100644 index 00000000..efb44896 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/046_vsa_dss_2015_2_d_t_key_object_insert_metadata.sql @@ -0,0 +1,25 @@ +-- 24.11.2016 auch create statement nötig, Tabelle fehlt in --createscript (an Eisenhut gemeldet) +-- Stefan Burckhardt + +-- Table: vsadss2015_2_d_391.t_key_object + +-- DROP TABLE vsadss2015_2_d_391.t_key_object; + +CREATE TABLE vsa_dss_2015_2_d.t_key_object +( + t_key character varying(30) NOT NULL, + t_lastuniqueid integer NOT NULL, + t_lastchange timestamp without time zone NOT NULL, + t_createdate timestamp without time zone NOT NULL, + t_user character varying(40) NOT NULL, + CONSTRAINT t_key_object_pkey PRIMARY KEY (t_key) +) +WITH ( + OIDS=FALSE +); +ALTER TABLE vsa_dss_2015_2_d.t_key_object + OWNER TO postgres; + +-- erster Eintrag in t_key_object + +INSERT INTO vsa_dss_2015_2_d.t_key_object (t_key, t_lastuniqueid, t_lastchange, t_createdate, t_user) VALUES ( 't_id', 0, current_timestamp, current_timestamp, 'postgres'); diff --git a/docs/stefans_scripts/export/vsa_dss_2015/051_vsa_dss_2015_2_d_interlisexport2.sql b/docs/stefans_scripts/export/vsa_dss_2015/051_vsa_dss_2015_2_d_interlisexport2.sql new file mode 100644 index 00000000..b100780b --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/051_vsa_dss_2015_2_d_interlisexport2.sql @@ -0,0 +1,728 @@ +------ This file is sql code to Export QGEP (Modul VSA-DSS) in English to INTERLIS in German on QQIS +------ Second version using tid_generate and tid_lookup +------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch +------ version 26.11.2016 15:42:44 / update 4.7.2017 od_text -> txt_text dito symbol, t_key_object auskommentiert +BEGIN; +---DELETE FROM vsa_dss_2015_2_d.erhaltungsereignis_abwasserbauwerk; +DELETE FROM vsa_dss_2015_2_d.erhaltungsereignis_abwasserbauwerkassoc; +-- DELETE FROM vsa_dss_2015_2_d.symbol; +DELETE FROM vsa_dss_2015_2_d.abwasserbauwerk_symbol; +-- DELETE FROM vsa_dss_2015_2_d.text; +DELETE FROM vsa_dss_2015_2_d.abwasserbauwerk_text; +DELETE FROM vsa_dss_2015_2_d.haltung_text; +DELETE FROM vsa_dss_2015_2_d.einzugsgebiet_text; +DELETE FROM vsa_dss_2015_2_d.mutation; +DELETE FROM vsa_dss_2015_2_d.grundwasserleiter; +DELETE FROM vsa_dss_2015_2_d.oberflaechengewaesser; +DELETE FROM vsa_dss_2015_2_d.fliessgewaesser; +DELETE FROM vsa_dss_2015_2_d.see; +DELETE FROM vsa_dss_2015_2_d.gewaesserabschnitt; +DELETE FROM vsa_dss_2015_2_d.wasserfassung; +DELETE FROM vsa_dss_2015_2_d.ufer; +DELETE FROM vsa_dss_2015_2_d.gewaessersohle; +DELETE FROM vsa_dss_2015_2_d.gewaessersektor; +DELETE FROM vsa_dss_2015_2_d.organisation; +DELETE FROM vsa_dss_2015_2_d.genossenschaft_korporation; +DELETE FROM vsa_dss_2015_2_d.kanton; +DELETE FROM vsa_dss_2015_2_d.abwasserverband; +DELETE FROM vsa_dss_2015_2_d.gemeinde; +DELETE FROM vsa_dss_2015_2_d.amt; +DELETE FROM vsa_dss_2015_2_d.abwasserreinigungsanlage; +DELETE FROM vsa_dss_2015_2_d.privat; +DELETE FROM vsa_dss_2015_2_d.abwasserbauwerk; +DELETE FROM vsa_dss_2015_2_d.kanal; +DELETE FROM vsa_dss_2015_2_d.normschacht; +DELETE FROM vsa_dss_2015_2_d.einleitstelle; +DELETE FROM vsa_dss_2015_2_d.spezialbauwerk; +DELETE FROM vsa_dss_2015_2_d.versickerungsanlage; +DELETE FROM vsa_dss_2015_2_d.arabauwerk; +DELETE FROM vsa_dss_2015_2_d.erhaltungsereignis; +DELETE FROM vsa_dss_2015_2_d.zone; +DELETE FROM vsa_dss_2015_2_d.planungszone; +DELETE FROM vsa_dss_2015_2_d.versickerungsbereich; +DELETE FROM vsa_dss_2015_2_d.entwaesserungssystem; +DELETE FROM vsa_dss_2015_2_d.gewaesserschutzbereich; +DELETE FROM vsa_dss_2015_2_d.grundwasserschutzareal; +DELETE FROM vsa_dss_2015_2_d.grundwasserschutzzone; +DELETE FROM vsa_dss_2015_2_d.rohrprofil; +DELETE FROM vsa_dss_2015_2_d.araenergienutzung; +DELETE FROM vsa_dss_2015_2_d.abwasserbehandlung; +DELETE FROM vsa_dss_2015_2_d.schlammbehandlung; +DELETE FROM vsa_dss_2015_2_d.steuerungszentrale; +DELETE FROM vsa_dss_2015_2_d.gewaesserverbauung; +DELETE FROM vsa_dss_2015_2_d.furt; +DELETE FROM vsa_dss_2015_2_d.gewaesserabsturz; +DELETE FROM vsa_dss_2015_2_d.schleuse; +DELETE FROM vsa_dss_2015_2_d.durchlass; +DELETE FROM vsa_dss_2015_2_d.geschiebesperre; +DELETE FROM vsa_dss_2015_2_d.gewaesserwehr; +DELETE FROM vsa_dss_2015_2_d.sohlrampe; +DELETE FROM vsa_dss_2015_2_d.fischpass; +DELETE FROM vsa_dss_2015_2_d.badestelle; +DELETE FROM vsa_dss_2015_2_d.hydr_geometrie; +DELETE FROM vsa_dss_2015_2_d.abwassernetzelement; +DELETE FROM vsa_dss_2015_2_d.haltungspunkt; +DELETE FROM vsa_dss_2015_2_d.abwasserknoten; +DELETE FROM vsa_dss_2015_2_d.haltung_alternativverlauf; +DELETE FROM vsa_dss_2015_2_d.haltung; +DELETE FROM vsa_dss_2015_2_d.rohrprofil_geometrie; +DELETE FROM vsa_dss_2015_2_d.hydr_geomrelation; +DELETE FROM vsa_dss_2015_2_d.mechanischevorreinigung; +DELETE FROM vsa_dss_2015_2_d.retentionskoerper; +DELETE FROM vsa_dss_2015_2_d.ueberlaufcharakteristik; +DELETE FROM vsa_dss_2015_2_d.hq_relation; +DELETE FROM vsa_dss_2015_2_d.bauwerksteil; +DELETE FROM vsa_dss_2015_2_d.trockenwetterfallrohr; +DELETE FROM vsa_dss_2015_2_d.einstiegshilfe; +DELETE FROM vsa_dss_2015_2_d.trockenwetterrinne; +DELETE FROM vsa_dss_2015_2_d.deckel; +DELETE FROM vsa_dss_2015_2_d.elektrischeeinrichtung; +DELETE FROM vsa_dss_2015_2_d.elektromechanischeausruestung; +DELETE FROM vsa_dss_2015_2_d.bankett; +DELETE FROM vsa_dss_2015_2_d.anschlussobjekt; +DELETE FROM vsa_dss_2015_2_d.gebaeude; +DELETE FROM vsa_dss_2015_2_d.reservoir; +DELETE FROM vsa_dss_2015_2_d.einzelflaeche; +DELETE FROM vsa_dss_2015_2_d.brunnen; +DELETE FROM vsa_dss_2015_2_d.gefahrenquelle; +DELETE FROM vsa_dss_2015_2_d.unfall; +DELETE FROM vsa_dss_2015_2_d.stoff; +DELETE FROM vsa_dss_2015_2_d.einzugsgebiet; +DELETE FROM vsa_dss_2015_2_d.oberflaechenabflussparameter; +DELETE FROM vsa_dss_2015_2_d.messstelle; +DELETE FROM vsa_dss_2015_2_d.messgeraet; +DELETE FROM vsa_dss_2015_2_d.messreihe; +DELETE FROM vsa_dss_2015_2_d.messresultat; +DELETE FROM vsa_dss_2015_2_d.ueberlauf; +DELETE FROM vsa_dss_2015_2_d.absperr_drosselorgan; +DELETE FROM vsa_dss_2015_2_d.streichwehr; +DELETE FROM vsa_dss_2015_2_d.foerderaggregat; +DELETE FROM vsa_dss_2015_2_d.leapingwehr; +DELETE FROM vsa_dss_2015_2_d.hydr_kennwerte; +DELETE FROM vsa_dss_2015_2_d.rueckstausicherung; +DELETE FROM vsa_dss_2015_2_d.feststoffrueckhalt; +DELETE FROM vsa_dss_2015_2_d.beckenreinigung; +DELETE FROM vsa_dss_2015_2_d.beckenentleerung; +DELETE FROM vsa_dss_2015_2_d.ezg_parameter_allg; +DELETE FROM vsa_dss_2015_2_d.ezg_parameter_mouse1; + + +DELETE FROM vsa_dss_2015_2_d.sia405_symbolpos; +DELETE FROM vsa_dss_2015_2_d.symbolpos; +DELETE FROM vsa_dss_2015_2_d.sia405_textpos; +DELETE FROM vsa_dss_2015_2_d.textpos; + +DELETE FROM vsa_dss_2015_2_d.metaattribute; +DELETE FROM vsa_dss_2015_2_d.sia405_baseclass; +DELETE FROM vsa_dss_2015_2_d.baseclass; + +-- Sequence: vsa_dss_2015_2_d.t_ili2db_seq +-- DROP SEQUENCE vsa_dss_2015_2_d.t_ili2db_seq; +--CREATE SEQUENCE vsa_dss_2015_2_d.t_ili2db_seq +-- INCREMENT 1 +-- MINVALUE 1 +-- MAXVALUE 9223372036854775807 +-- Start 1 +-- CACHE 1; +--ALTER TABLE vsa_dss_2015_2_d.t_ili2db_seq +-- OWNER TO postgres; +-- Table: vsa_dss_2015_2_d.t_key_object + +---Keep for backward compatibility for the moment +-- DROP TABLE vsa_dss_2015_2_d.t_key_object; +--CREATE TABLE vsa_dss_2015_2_d.t_key_object +--( +-- t_key character varying(30) NOT NULL, +-- t_lastuniqueid integer NOT NULL, +-- t_lastchange timestamp without time zone NOT NULL, +-- t_createdate timestamp without time zone NOT NULL, +-- t_user character varying(40) NOT NULL, +-- CONSTRAINT t_key_object_pkey PRIMARY KEY (t_key) +--) +--WITH ( +-- OIDS = False +--); +--ALTER TABLE vsa_dss_2015_2_d.t_key_object +-- OWNER TO postgres; +--- t_key_object aktualisieren (046 ist schon gelaufen, es gibt einen Datensatz) + +-- INSERT INTO vsa_dss_2015_2_d.t_key_object (t_key, t_lastuniqueid, t_lastchange, t_createdate, t_user) VALUES ( 't_id', 0, current_timestamp, current_timestamp, 'postgres'); +UPDATE vsa_dss_2015_2_d.t_key_object SET t_lastuniqueid = 4, t_createdate = current_timestamp, t_user = 'postgres'; + +--- sequence ist schon initialisiert +--- t_ili2db_dataset initialisieren + +-- 26.11.2016 korrigiert +--UPDATE vsa_dss_2015_2_d.t_ili2db_dataset SET t_id = 1, datasetname = 'vsa_dss_2015_d_340_qgepexport'; +INSERT INTO vsa_dss_2015_2_d.t_ili2db_dataset (t_id, datasetname) VALUES ( 1, 'vsa_dss_2015_d_304_qgepexport'); + +--- t_ili2db_import initialisieren +INSERT INTO vsa_dss_2015_2_d.t_ili2db_import (t_id, dataset, importdate, importuser, importfile) VALUES ( 2, 1, current_timestamp, 'postgres', 'qgepexport.xtf'); + +--- t_ili2db_basket initialisieren +INSERT INTO vsa_dss_2015_2_d.t_ili2db_basket (t_id, dataset, topic, t_ili_tid, attachmentkey) VALUES ( 3, 1, 'DSS_2015.Siedlungsentwaesserung', 'xBASKET1', 'qgepexport.xtf-3'); + +--- t_ili2db_import_basket initialisieren +INSERT INTO vsa_dss_2015_2_d.t_ili2db_import_basket (t_id, import, basket, objectcount, start_t_id, end_t_id) VALUES ( 4, 2, 3, 0, 3, 3); + + +--- OK: fk_Attributes +--- OK: JOIN for fk_dataowner / provider +--- in Progress: organisation.fk_part_of data - prepared, but no qgep.table hierarchy and data, dito for all other class - class associations +--- Not tested: if data with reach - reach connection +--- TO DO: create dataset, create import and create_import_basket data + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('hydr_kennwerte', obj_id), 'hydr_kennwerte', obj_id +FROM qgep_od.hydraulic_characteristic_data; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_kennwerte', obj_id), obj_id +FROM qgep_od.hydraulic_characteristic_data; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('absperr_drosselorgan', obj_id), 'absperr_drosselorgan', obj_id +FROM qgep_od.throttle_shut_off_unit; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('absperr_drosselorgan', obj_id), obj_id +FROM qgep_od.throttle_shut_off_unit; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('ueberlauf', obj_id), 'ueberlauf', obj_id +FROM qgep_od.overflow; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlauf', obj_id), obj_id +FROM qgep_od.overflow; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('messresultat', obj_id), 'messresultat', obj_id +FROM qgep_od.measurement_result; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('messresultat', obj_id), obj_id +FROM qgep_od.measurement_result; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('messreihe', obj_id), 'messreihe', obj_id +FROM qgep_od.measurement_series; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('messreihe', obj_id), obj_id +FROM qgep_od.measurement_series; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('messgeraet', obj_id), 'messgeraet', obj_id +FROM qgep_od.measuring_device; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('messgeraet', obj_id), obj_id +FROM qgep_od.measuring_device; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('messstelle', obj_id), 'messstelle', obj_id +FROM qgep_od.measuring_point; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('messstelle', obj_id), obj_id +FROM qgep_od.measuring_point; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('oberflaechenabflussparameter', obj_id), 'oberflaechenabflussparameter', obj_id +FROM qgep_od.surface_runoff_parameters; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechenabflussparameter', obj_id), obj_id +FROM qgep_od.surface_runoff_parameters; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('einzugsgebiet', obj_id), 'einzugsgebiet', obj_id +FROM qgep_od.catchment_area; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('einzugsgebiet', obj_id), obj_id +FROM qgep_od.catchment_area; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('stoff', obj_id), 'stoff', obj_id +FROM qgep_od.substance; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('stoff', obj_id), obj_id +FROM qgep_od.substance; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('unfall', obj_id), 'unfall', obj_id +FROM qgep_od.accident; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('unfall', obj_id), obj_id +FROM qgep_od.accident; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('gefahrenquelle', obj_id), 'gefahrenquelle', obj_id +FROM qgep_od.hazard_source; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('gefahrenquelle', obj_id), obj_id +FROM qgep_od.hazard_source; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('anschlussobjekt', obj_id), 'anschlussobjekt', obj_id +FROM qgep_od.connection_object; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('anschlussobjekt', obj_id), obj_id +FROM qgep_od.connection_object; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('bauwerksteil', obj_id), 'bauwerksteil', obj_id +FROM qgep_od.structure_part; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('bauwerksteil', obj_id), obj_id +FROM qgep_od.structure_part; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('hq_relation', obj_id), 'hq_relation', obj_id +FROM qgep_od.hq_relation; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('hq_relation', obj_id), obj_id +FROM qgep_od.hq_relation; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('ueberlaufcharakteristik', obj_id), 'ueberlaufcharakteristik', obj_id +FROM qgep_od.overflow_characteristic; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlaufcharakteristik', obj_id), obj_id +FROM qgep_od.overflow_characteristic; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('retentionskoerper', obj_id), 'retentionskoerper', obj_id +FROM qgep_od.retention_body; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('retentionskoerper', obj_id), obj_id +FROM qgep_od.retention_body; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('mechanischevorreinigung', obj_id), 'mechanischevorreinigung', obj_id +FROM qgep_od.mechanical_pretreatment; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('mechanischevorreinigung', obj_id), obj_id +FROM qgep_od.mechanical_pretreatment; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('hydr_geomrelation', obj_id), 'hydr_geomrelation', obj_id +FROM qgep_od.hydr_geom_relation; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geomrelation', obj_id), obj_id +FROM qgep_od.hydr_geom_relation; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('rohrprofil_geometrie', obj_id), 'rohrprofil_geometrie', obj_id +FROM qgep_od.profile_geometry; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil_geometrie', obj_id), obj_id +FROM qgep_od.profile_geometry; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('haltungspunkt', obj_id), 'haltungspunkt', obj_id +FROM qgep_od.reach_point; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('haltungspunkt', obj_id), obj_id +FROM qgep_od.reach_point; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('abwassernetzelement', obj_id), 'abwassernetzelement', obj_id +FROM qgep_od.wastewater_networkelement; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('abwassernetzelement', obj_id), obj_id +FROM qgep_od.wastewater_networkelement; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('hydr_geometrie', obj_id), 'hydr_geometrie', obj_id +FROM qgep_od.hydr_geometry; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geometrie', obj_id), obj_id +FROM qgep_od.hydr_geometry; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('badestelle', obj_id), 'badestelle', obj_id +FROM qgep_od.bathing_area; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('badestelle', obj_id), obj_id +FROM qgep_od.bathing_area; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('fischpass', obj_id), 'fischpass', obj_id +FROM qgep_od.fish_pass; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('fischpass', obj_id), obj_id +FROM qgep_od.fish_pass; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('gewaesserverbauung', obj_id), 'gewaesserverbauung', obj_id +FROM qgep_od.water_control_structure; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserverbauung', obj_id), obj_id +FROM qgep_od.water_control_structure; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('steuerungszentrale', obj_id), 'steuerungszentrale', obj_id +FROM qgep_od.control_center; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('steuerungszentrale', obj_id), obj_id +FROM qgep_od.control_center; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('schlammbehandlung', obj_id), 'schlammbehandlung', obj_id +FROM qgep_od.sludge_treatment; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('schlammbehandlung', obj_id), obj_id +FROM qgep_od.sludge_treatment; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('abwasserbehandlung', obj_id), 'abwasserbehandlung', obj_id +FROM qgep_od.waste_water_treatment; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbehandlung', obj_id), obj_id +FROM qgep_od.waste_water_treatment; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('araenergienutzung', obj_id), 'araenergienutzung', obj_id +FROM qgep_od.wwtp_energy_use; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('araenergienutzung', obj_id), obj_id +FROM qgep_od.wwtp_energy_use; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('rohrprofil', obj_id), 'rohrprofil', obj_id +FROM qgep_od.pipe_profile; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil', obj_id), obj_id +FROM qgep_od.pipe_profile; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('zone', obj_id), 'zone', obj_id +FROM qgep_od.zone; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('zone', obj_id), obj_id +FROM qgep_od.zone; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('erhaltungsereignis', obj_id), 'erhaltungsereignis', obj_id +FROM qgep_od.maintenance_event; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis', obj_id), obj_id +FROM qgep_od.maintenance_event; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('abwasserbauwerk', obj_id), 'abwasserbauwerk', obj_id +FROM qgep_od.wastewater_structure; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbauwerk', obj_id), obj_id +FROM qgep_od.wastewater_structure; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('organisation', obj_id), 'organisation', obj_id +FROM qgep_od.organisation; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('organisation', obj_id), obj_id +FROM qgep_od.organisation; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('gewaessersektor', obj_id), 'gewaessersektor', obj_id +FROM qgep_od.sector_water_body; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersektor', obj_id), obj_id +FROM qgep_od.sector_water_body; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('gewaessersohle', obj_id), 'gewaessersohle', obj_id +FROM qgep_od.river_bed; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersohle', obj_id), obj_id +FROM qgep_od.river_bed; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('ufer', obj_id), 'ufer', obj_id +FROM qgep_od.river_bank; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('ufer', obj_id), obj_id +FROM qgep_od.river_bank; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('wasserfassung', obj_id), 'wasserfassung', obj_id +FROM qgep_od.water_catchment; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('wasserfassung', obj_id), obj_id +FROM qgep_od.water_catchment; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('gewaesserabschnitt', obj_id), 'gewaesserabschnitt', obj_id +FROM qgep_od.water_course_segment; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserabschnitt', obj_id), obj_id +FROM qgep_od.water_course_segment; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('oberflaechengewaesser', obj_id), 'oberflaechengewaesser', obj_id +FROM qgep_od.surface_water_bodies; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechengewaesser', obj_id), obj_id +FROM qgep_od.surface_water_bodies; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('grundwasserleiter', obj_id), 'grundwasserleiter', obj_id +FROM qgep_od.aquifier; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('grundwasserleiter', obj_id), obj_id +FROM qgep_od.aquifier; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('mutation', obj_id), 'mutation', obj_id +FROM qgep_od.mutation; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('mutation', obj_id), obj_id +FROM qgep_od.mutation; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('text', obj_id), 'text', obj_id +FROM qgep_od.txt_text; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('text', obj_id), obj_id +FROM qgep_od.txt_text; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('symbol', obj_id), 'symbol', obj_id +FROM qgep_od.txt_symbol; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('symbol', obj_id), obj_id +FROM qgep_od.txt_symbol; + +INSERT INTO vsa_dss_2015_2_d.baseclass +( +t_id, t_type, t_ili_tid) +SELECT vsa_dss_2015_2_d.tid_generate('erhaltungsereignis_abwasserbauwerk', obj_id), 'erhaltungsereignis_abwasserbauwerk', obj_id +FROM qgep_od.re_maintenance_event_wastewater_structure; + +INSERT INTO vsa_dss_2015_2_d.sia405_baseclass +( +t_id, obj_id) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis_abwasserbauwerk', obj_id), obj_id +FROM qgep_od.re_maintenance_event_wastewater_structure; + + +COMMIT; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/052a_vsa_dss_2015_2_d_interlisexport2.sql b/docs/stefans_scripts/export/vsa_dss_2015/052a_vsa_dss_2015_2_d_interlisexport2.sql new file mode 100644 index 00000000..68361266 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/052a_vsa_dss_2015_2_d_interlisexport2.sql @@ -0,0 +1,2180 @@ +------ This file is sql code to Export QGEP (Modul VSA-DSS) in English to INTERLIS in German on QQIS +------ Second version using tid_generate and tid_lookup +------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch +------ version 21.11.2016 21:07:32 +------ 22.11.2016 / 26.11.2016 modified +------ 1.6.2017 Korrektur Ausfuehrende_Firma statt Aufuehrender_Firma +------ 4.7.2017 ST_Force2D(detail_geometry_geometry) ergänzt bei allen _geometry und _progression attributen + +-- 22.11.2016 modified +-- INSERT INTO vsa_dss_2015_2_d.erhaltungsereignis_abwasserbauwerk +INSERT INTO vsa_dss_2015_2_d.erhaltungsereignis_abwasserbauwerkassoc +( +t_id, abwasserbauwerkref, erhaltungsereignis_abwasserbauwerkassocref) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis_abwasserbauwerkassoc', obj_id), vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure), vsa_dss_2015_2_d.tid_lookup('Erhaltungsereignis', fk_maintenance_event) +FROM qgep_od.re_maintenance_event_wastewater_structure; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, +-- datenherr, +-- datenlieferant, +-- letzte_aenderung, +sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis_abwasserbauwerkassoc', qgep_od.re_maintenance_event_wastewater_structure.obj_id), '0', +-- a.identifier as dataowner, +-- b.identifier as provider, +-- re_maintenance_event_wastewater_structure.last_modification, +vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis_abwasserbauwerkassoc', qgep_od.re_maintenance_event_wastewater_structure.obj_id) +FROM qgep_od.re_maintenance_event_wastewater_structure; +-- LEFT JOIN qgep_od.organisation as a ON re_maintenance_event_wastewater_structure.fk_dataowner = a.obj_id +-- LEFT JOIN qgep_od.organisation as b ON re_maintenance_event_wastewater_structure.fk_provider = b.obj_id; + +/* +INSERT INTO vsa_dss_2015_2_d.symbol +( +t_id, klasse, plantyp, bemerkung, symbolskalierunghoch, symbolskalierunglaengs, symbolhali, symbolori, symbolpos, symbolvali) +SELECT vsa_dss_2015_2_d.tid_lookup('symbol', obj_id), class, plantype, remark, symbol_scaling_heigth, symbol_scaling_width, symbolhali, symbolori, ST_Force2D(symbolpos_geometry), symbolvali +FROM qgep_od.symbol; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('symbol', qgep_od.symbol.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_symbol.last_modification, vsa_dss_2015_2_d.tid_lookup('symbol', qgep_od.symbol.obj_id) +FROM qgep_od.symbol + LEFT JOIN qgep_od.organisation as a ON od_symbol.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_symbol.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.text +( +t_id, klasse, plantyp, bemerkung, textinhalt, texthali, textori, textpos, textvali) +SELECT vsa_dss_2015_2_d.tid_lookup('text', obj_id), class, plantype, remark, text, texthali, textori, ST_Force2D(textpos_geometry), textvali +FROM qgep_od.text; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('text', qgep_od.text.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_text.last_modification, vsa_dss_2015_2_d.tid_lookup('text', qgep_od.text.obj_id) +FROM qgep_od.text + LEFT JOIN qgep_od.organisation as a ON od_text.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_text.fk_provider = b.obj_id; +*/ + +INSERT INTO vsa_dss_2015_2_d.mutation +( +t_id, attribut, klasse, mutationsdatum, aufnahmedatum, art, letzter_wert, objekt, aufnehmer, bemerkung, systembenutzer) +SELECT vsa_dss_2015_2_d.tid_lookup('mutation', obj_id), attribute, class, date_mutation, date_time, +CASE WHEN kind = 5523 THEN 'erstellt' ---- 5523 created +WHEN kind = 5582 THEN 'geaendert' ---- 5582 changed +WHEN kind = 5583 THEN 'geloescht' ---- 5583 deleted +END, last_value, object, recorded_by, remark, system_user +FROM qgep_od.mutation; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('mutation', qgep_od.mutation.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_mutation.last_modification, vsa_dss_2015_2_d.tid_lookup('mutation', qgep_od.mutation.obj_id) +FROM qgep_od.mutation + LEFT JOIN qgep_od.organisation as a ON od_mutation.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_mutation.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.grundwasserleiter +( +t_id, mittlerergwspiegel, bezeichnung, maxgwspiegel, mingwspiegel, perimeter, bemerkung) +SELECT vsa_dss_2015_2_d.tid_lookup('grundwasserleiter', obj_id), average_groundwater_level, identifier, maximal_groundwater_level, minimal_groundwater_level, ST_Force2D(perimeter_geometry), remark +FROM qgep_od.aquifier; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('grundwasserleiter', qgep_od.aquifier.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_aquifier.last_modification, vsa_dss_2015_2_d.tid_lookup('grundwasserleiter', qgep_od.aquifier.obj_id) +FROM qgep_od.aquifier + LEFT JOIN qgep_od.organisation as a ON od_aquifier.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_aquifier.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.oberflaechengewaesser +( +t_id, bezeichnung, bemerkung) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechengewaesser', obj_id), identifier, remark +FROM qgep_od.surface_water_bodies; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechengewaesser', qgep_od.surface_water_bodies.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_surface_water_bodies.last_modification, vsa_dss_2015_2_d.tid_lookup('oberflaechengewaesser', qgep_od.surface_water_bodies.obj_id) +FROM qgep_od.surface_water_bodies + LEFT JOIN qgep_od.organisation as a ON od_surface_water_bodies.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_surface_water_bodies.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.fliessgewaesser +( +t_id, art) +SELECT vsa_dss_2015_2_d.tid_lookup('fliessgewaesser', obj_id), +CASE WHEN kind = 3397 THEN 'Gletscherbach' ---- 3397 englacial_river +WHEN kind = 3399 THEN 'Moorbach' ---- 3399 moor_creek +WHEN kind = 3398 THEN 'Seeausfluss' ---- 3398 lake_outflow +WHEN kind = 3396 THEN 'Travertinbach' ---- 3396 travertine_river +WHEN kind = 3400 THEN 'unbekannt' ---- 3400 unknown +END +FROM qgep_od.river; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'fliessgewaesser' +FROM + vsa_dss_2015_2_d.fliessgewaesser a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.see +( +t_id, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('see', obj_id), ST_Force2D(perimeter_geometry) +FROM qgep_od.lake; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'see' +FROM + vsa_dss_2015_2_d.see a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gewaesserabschnitt +( +t_id, algenbewuchs, hoehenstufe, sohlenbreite, totholz, tiefenvariabilitaet, abflussregime, oekom_klassifizierung, von, bezeichnung, art, laengsprofil, makrophytenbewuchs, bemerkung, linienfuehrung, groesse, gefaelle, bis, nutzung, wasserhaerte, breitenvariabilitaet, fliessgewaesserref) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserabschnitt', obj_id), +CASE WHEN algae_growth = 2623 THEN 'kein_gering' ---- 2623 none_or_marginal +WHEN algae_growth = 2624 THEN 'maessig_stark' ---- 2624 moderate_to_strong +WHEN algae_growth = 2625 THEN 'uebermaessig_wuchernd' ---- 2625 excessive_rampant +WHEN algae_growth = 3050 THEN 'unbekannt' ---- 3050 unknown +END, +CASE WHEN altitudinal_zone = 320 THEN 'alpin' ---- 320 alpine +WHEN altitudinal_zone = 294 THEN 'kollin' ---- 294 foothill_zone +WHEN altitudinal_zone = 295 THEN 'montan' ---- 295 montane +WHEN altitudinal_zone = 319 THEN 'subalpin' ---- 319 subalpine +WHEN altitudinal_zone = 3020 THEN 'unbekannt' ---- 3020 unknown +END, bed_with, +CASE WHEN dead_wood = 2629 THEN 'Ansammlungen' ---- 2629 accumulations +WHEN dead_wood = 2631 THEN 'kein_vereinzelt' ---- 2631 none_or_sporadic +WHEN dead_wood = 3052 THEN 'unbekannt' ---- 3052 unknown +WHEN dead_wood = 2630 THEN 'zerstreut' ---- 2630 scattered +END, +CASE WHEN depth_variability = 2617 THEN 'ausgepraegt' ---- 2617 pronounced +WHEN depth_variability = 2619 THEN 'keine' ---- 2619 none +WHEN depth_variability = 2618 THEN 'maessig' ---- 2618 moderate +WHEN depth_variability = 3049 THEN 'unbekannt' ---- 3049 unknown +END, +CASE WHEN discharge_regime = 297 THEN 'beeintraechtigt' ---- 297 compromised +WHEN discharge_regime = 428 THEN 'kuenstlich' ---- 428 artificial +WHEN discharge_regime = 427 THEN 'naturfern' ---- 427 hardly_natural +WHEN discharge_regime = 296 THEN 'naturnah' ---- 296 close_to_natural +WHEN discharge_regime = 3091 THEN 'unbekannt' ---- 3091 unknown +END, +CASE WHEN ecom_classification = 3496 THEN 'eingedolt' ---- 3496 covered +WHEN ecom_classification = 3495 THEN 'kuenstlich_naturfremd' ---- 3495 artificial +WHEN ecom_classification = 3492 THEN 'natuerlich_naturnah' ---- 3492 natural_or_seminatural +WHEN ecom_classification = 3491 THEN 'nicht_klassiert' ---- 3491 not_classified +WHEN ecom_classification = 3494 THEN 'stark_beeintraechtigt' ---- 3494 heavily_compromised +WHEN ecom_classification = 3493 THEN 'wenig_beeintraechtigt' ---- 3493 partially_compromised +END, ST_Force2D(from_geometry), identifier, +CASE WHEN kind = 2710 THEN 'eingedolt' ---- 2710 covered +WHEN kind = 2709 THEN 'offen' ---- 2709 open +WHEN kind = 3058 THEN 'unbekannt' ---- 3058 unknown +END, +CASE WHEN length_profile = 97 THEN 'kaskadenartig' ---- 97 downwelling +WHEN length_profile = 3602 THEN 'Schnellen_Kolke' ---- 3602 rapids_or_potholes +WHEN length_profile = 99 THEN 'stetig' ---- 99 continuous +WHEN length_profile = 3035 THEN 'unbekannt' ---- 3035 unknown +END, +CASE WHEN macrophyte_coverage = 2626 THEN 'kein_gering' ---- 2626 none_or_marginal +WHEN macrophyte_coverage = 2627 THEN 'maessig_stark' ---- 2627 moderate_to_strong +WHEN macrophyte_coverage = 2628 THEN 'uebermaessig_wuchernd' ---- 2628 excessive_rampant +WHEN macrophyte_coverage = 3051 THEN 'unbekannt' ---- 3051 unknown +END, remark, +CASE WHEN section_morphology = 4575 THEN 'gerade' ---- 4575 straight +WHEN section_morphology = 4580 THEN 'leichtbogig' ---- 4580 moderately_bent +WHEN section_morphology = 4579 THEN 'maeandrierend' ---- 4579 meandering +WHEN section_morphology = 4578 THEN 'starkbogig' ---- 4578 heavily_bent +WHEN section_morphology = 4576 THEN 'unbekannt' ---- 4576 unknown +END, size, +CASE WHEN slope = 291 THEN 'flach' ---- 291 shallow_dipping +WHEN slope = 292 THEN 'mittel' ---- 292 moderate_slope +WHEN slope = 293 THEN 'steil' ---- 293 steep +WHEN slope = 3019 THEN 'unbekannt' ---- 3019 unknown +END, ST_Force2D(to_geometry), +CASE WHEN utilisation = 384 THEN 'Erholung' ---- 384 recreation +WHEN utilisation = 429 THEN 'Fischerei' ---- 429 fishing +WHEN utilisation = 385 THEN 'Stauanlage' ---- 385 dam +WHEN utilisation = 3039 THEN 'unbekannt' ---- 3039 unknown +END, +CASE WHEN water_hardness = 321 THEN 'Kalk' ---- 321 limestone +WHEN water_hardness = 322 THEN 'Silikat' ---- 322 silicate +WHEN water_hardness = 3024 THEN 'unbekannt' ---- 3024 unknown +END, +CASE WHEN width_variability = 176 THEN 'ausgepraegt' ---- 176 pronounced +WHEN width_variability = 177 THEN 'eingeschraenkt' ---- 177 limited +WHEN width_variability = 178 THEN 'keine' ---- 178 none +WHEN width_variability = 3078 THEN 'unbekannt' ---- 3078 unknown +END, vsa_dss_2015_2_d.tid_lookup('Fliessgewaesser', fk_watercourse) +FROM qgep_od.water_course_segment; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserabschnitt', qgep_od.water_course_segment.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_water_course_segment.last_modification, vsa_dss_2015_2_d.tid_lookup('gewaesserabschnitt', qgep_od.water_course_segment.obj_id) +FROM qgep_od.water_course_segment + LEFT JOIN qgep_od.organisation as a ON od_water_course_segment.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_water_course_segment.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.wasserfassung +( +t_id, bezeichnung, art, bemerkung, lage, grundwasserleiterref, oberflaechengewaesserref) +SELECT vsa_dss_2015_2_d.tid_lookup('wasserfassung', obj_id), identifier, +CASE WHEN kind = 24 THEN 'Brauchwasser' ---- 24 process_water +WHEN kind = 25 THEN 'Trinkwasser' ---- 25 drinking_water +WHEN kind = 3075 THEN 'unbekannt' ---- 3075 unknown +END, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Grundwasserleiter', fk_aquifier), vsa_dss_2015_2_d.tid_lookup('Oberflaechengewaesser', fk_chute) +FROM qgep_od.water_catchment; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('wasserfassung', qgep_od.water_catchment.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_water_catchment.last_modification, vsa_dss_2015_2_d.tid_lookup('wasserfassung', qgep_od.water_catchment.obj_id) +FROM qgep_od.water_catchment + LEFT JOIN qgep_od.organisation as a ON od_water_catchment.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_water_catchment.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.ufer +( +t_id, verbauungsgrad, bezeichnung, bemerkung, verbauungsart, uferbereich, seite, umlandnutzung, vegetation, breite, gewaesserabschnittref) +SELECT vsa_dss_2015_2_d.tid_lookup('ufer', obj_id), +CASE WHEN control_grade_of_river = 341 THEN 'keine' ---- 341 none +WHEN control_grade_of_river = 2612 THEN 'maessig' ---- 2612 moderate +WHEN control_grade_of_river = 2613 THEN 'stark' ---- 2613 strong +WHEN control_grade_of_river = 2614 THEN 'ueberwiegend' ---- 2614 predominantly +WHEN control_grade_of_river = 3026 THEN 'unbekannt' ---- 3026 unknown +WHEN control_grade_of_river = 2611 THEN 'vereinzelt' ---- 2611 sporadic +WHEN control_grade_of_river = 2615 THEN 'vollstaendig' ---- 2615 complete +END, identifier, remark, +CASE WHEN river_control_type = 3489 THEN 'andere_dicht' ---- 3489 other_impermeable +WHEN river_control_type = 3486 THEN 'Betongitterstein_dicht' ---- 3486 concrete_chequer_brick_impermeable +WHEN river_control_type = 3485 THEN 'Holz_durchlaessig' ---- 3485 wood_permeable +WHEN river_control_type = 3482 THEN 'keine_Verbauung' ---- 3482 no_control_structure +WHEN river_control_type = 3483 THEN 'Lebendverbau_durchlaessig' ---- 3483 living_control_structure_permeable +WHEN river_control_type = 3488 THEN 'Mauer_dicht' ---- 3488 wall_impermeable +WHEN river_control_type = 3487 THEN 'Naturstein_dicht' ---- 3487 natural_stone_impermeable +WHEN river_control_type = 3484 THEN 'Naturstein_locker_durchlaessig' ---- 3484 loose_natural_stone_permeable +WHEN river_control_type = 3080 THEN 'unbekannt' ---- 3080 unknown +END, +CASE WHEN shores = 404 THEN 'gewaesserfremd' ---- 404 inappropriate_to_river +WHEN shores = 403 THEN 'gewaessergerecht' ---- 403 appropriate_to_river +WHEN shores = 405 THEN 'kuenstlich' ---- 405 artificial +WHEN shores = 3081 THEN 'unbekannt' ---- 3081 unknown +END, +CASE WHEN side = 420 THEN 'links' ---- 420 left +WHEN side = 421 THEN 'rechts' ---- 421 right +WHEN side = 3065 THEN 'unbekannt' ---- 3065 unknown +END, +CASE WHEN utilisation_of_shore_surroundings = 424 THEN 'Bebauungen' ---- 424 developed_area +WHEN utilisation_of_shore_surroundings = 425 THEN 'Gruenland' ---- 425 grassland +WHEN utilisation_of_shore_surroundings = 3068 THEN 'unbekannt' ---- 3068 unknown +WHEN utilisation_of_shore_surroundings = 426 THEN 'Wald' ---- 426 forest +END, +CASE WHEN vegetation = 325 THEN 'fehlend' ---- 325 missing +WHEN vegetation = 323 THEN 'standorttypisch' ---- 323 typical_for_habitat +WHEN vegetation = 324 THEN 'standortuntypisch' ---- 324 atypical_for_habitat +WHEN vegetation = 3025 THEN 'unbekannt' ---- 3025 unknown +END, width, vsa_dss_2015_2_d.tid_lookup('Gewaesserabschnitt', fk_water_course_segment) +FROM qgep_od.river_bank; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('ufer', qgep_od.river_bank.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_river_bank.last_modification, vsa_dss_2015_2_d.tid_lookup('ufer', qgep_od.river_bank.obj_id) +FROM qgep_od.river_bank + LEFT JOIN qgep_od.organisation as a ON od_river_bank.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_river_bank.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.gewaessersohle +( +t_id, verbauungsgrad, bezeichnung, art, bemerkung, verbauungsart, breite, gewaesserabschnittref) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersohle', obj_id), +CASE WHEN control_grade_of_river = 142 THEN 'keine' ---- 142 none +WHEN control_grade_of_river = 2607 THEN 'maessig' ---- 2607 moderate +WHEN control_grade_of_river = 2608 THEN 'stark' ---- 2608 heavily +WHEN control_grade_of_river = 2609 THEN 'ueberwiegend' ---- 2609 predominantly +WHEN control_grade_of_river = 3085 THEN 'unbekannt' ---- 3085 unknown +WHEN control_grade_of_river = 2606 THEN 'vereinzelt' ---- 2606 sporadic +WHEN control_grade_of_river = 2610 THEN 'vollstaendig' ---- 2610 complete +END, identifier, +CASE WHEN kind = 290 THEN 'hart' ---- 290 hard +WHEN kind = 3089 THEN 'unbekannt' ---- 3089 unknown +WHEN kind = 289 THEN 'weich' ---- 289 soft +END, remark, +CASE WHEN river_control_type = 3481 THEN 'andere_dicht' ---- 3481 other_impermeable +WHEN river_control_type = 338 THEN 'Betongittersteine' ---- 338 concrete_chequer_brick +WHEN river_control_type = 3479 THEN 'Holz' ---- 3479 wood +WHEN river_control_type = 3477 THEN 'keine_Verbauung' ---- 3477 no_control_structure +WHEN river_control_type = 3478 THEN 'Steinschuettung_Blockwurf' ---- 3478 rock_fill_or_loose_boulders +WHEN river_control_type = 3079 THEN 'unbekannt' ---- 3079 unknown +END, width, vsa_dss_2015_2_d.tid_lookup('Gewaesserabschnitt', fk_water_course_segment) +FROM qgep_od.river_bed; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersohle', qgep_od.river_bed.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_river_bed.last_modification, vsa_dss_2015_2_d.tid_lookup('gewaessersohle', qgep_od.river_bed.obj_id) +FROM qgep_od.river_bed + LEFT JOIN qgep_od.organisation as a ON od_river_bed.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_river_bed.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.gewaessersektor +( +t_id, bwg_code, bezeichnung, art, kilomo, kilomu, verlauf, reflaenge, bemerkung, oberflaechengewaesserref) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersektor', obj_id), code_bwg, identifier, +CASE WHEN kind = 2657 THEN 'Gewaesser' ---- 2657 waterbody +WHEN kind = 2729 THEN 'ParallelerAbschnitt' ---- 2729 parallel_section +WHEN kind = 2728 THEN 'Seetraverse' ---- 2728 lake_traversal +WHEN kind = 2656 THEN 'Ufer' ---- 2656 shore +WHEN kind = 3054 THEN 'unbekannt' ---- 3054 unknown +END, km_down, km_up, ST_Force2D(progression_geometry), ref_length, remark, vsa_dss_2015_2_d.tid_lookup('Oberflaechengewaesser', fk_chute) +FROM qgep_od.sector_water_body; + +-- additional Table Assoc: Gewaessersektor_VorherigerSektor/ no table hierarchy in qgep schema yet (check how to implement there) +-- INSERT INTO vsa_dss_2015_2_d.Gewaessersektor_VorherigerSektorassoc +-- ( +-- t_id, VorherigerSektorref, Gewaessersektor_VorherigerSektorassocref) +-- SELECT vsa_dss_2015_2_d.tid_lookup('Gewaessersektor', obj_id), vsa_dss_2015_2_d.tid_lookup('Gewaessersektor', fk_sector_previous),vsa_dss_2015_2_d.tid_lookup('Gewaessersektor', obj_id) +-- FROM qgep_od.gewaessersektor; + + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaessersektor', qgep_od.sector_water_body.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_sector_water_body.last_modification, vsa_dss_2015_2_d.tid_lookup('gewaessersektor', qgep_od.sector_water_body.obj_id) +FROM qgep_od.sector_water_body + LEFT JOIN qgep_od.organisation as a ON od_sector_water_body.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_sector_water_body.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.organisation +( +t_id, bezeichnung, bemerkung, uid) +SELECT vsa_dss_2015_2_d.tid_lookup('organisation', obj_id), identifier, remark, uid +FROM qgep_od.organisation; + +-- additional Table Assoc: Organisation_Teil_von/ no table hierarchy in qgep schema yet (check how to implement there) +-- INSERT INTO vsa_dss_2015_2_d.Organisation_Teil_vonassoc +-- ( +-- t_id, Teil_vonref, Organisation_Teil_vonassocref) +-- SELECT vsa_dss_2015_2_d.tid_lookup('Organisation', obj_id), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_part_of),vsa_dss_2015_2_d.tid_lookup('Organisation', obj_id) +-- FROM qgep_od.organisation; + + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('organisation', qgep_od.organisation.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_organisation.last_modification, vsa_dss_2015_2_d.tid_lookup('organisation', qgep_od.organisation.obj_id) +FROM qgep_od.organisation + LEFT JOIN qgep_od.organisation as a ON od_organisation.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_organisation.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.genossenschaft_korporation +( +t_id) +SELECT vsa_dss_2015_2_d.tid_lookup('genossenschaft_korporation', obj_id) +FROM qgep_od.cooperative; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'genossenschaft_korporation' +FROM + vsa_dss_2015_2_d.genossenschaft_korporation a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.kanton +( +t_id, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('kanton', obj_id), ST_Force2D(perimeter_geometry) +FROM qgep_od.canton; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'kanton' +FROM + vsa_dss_2015_2_d.kanton a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.abwasserverband +( +t_id) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserverband', obj_id) +FROM qgep_od.waste_water_association; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'abwasserverband' +FROM + vsa_dss_2015_2_d.abwasserverband a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gemeinde +( +t_id, hoehe, gep_jahr, gemeindenummer, perimeter, einwohner, flaeche) +SELECT vsa_dss_2015_2_d.tid_lookup('gemeinde', obj_id), altitude, gwdp_year, municipality_number, ST_Force2D(perimeter_geometry), population, total_surface +FROM qgep_od.municipality; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'gemeinde' +FROM + vsa_dss_2015_2_d.gemeinde a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.amt +( +t_id) +SELECT vsa_dss_2015_2_d.tid_lookup('amt', obj_id) +FROM qgep_od.administrative_office; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'amt' +FROM + vsa_dss_2015_2_d.amt a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.abwasserreinigungsanlage +( +t_id, bsb5, csb, eliminationcsb, eliminationn, eliminationnh4, eliminationp, anlagenummer, art, nh4, inbetriebnahme) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserreinigungsanlage', obj_id), bod5, cod, elimination_cod, elimination_n, elimination_nh4, elimination_p, installation_number, kind, nh4, start_year +FROM qgep_od.waste_water_treatment_plant; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'abwasserreinigungsanlage' +FROM + vsa_dss_2015_2_d.abwasserreinigungsanlage a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.privat +( +t_id, art) +SELECT vsa_dss_2015_2_d.tid_lookup('privat', obj_id), kind +FROM qgep_od.private; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'privat' +FROM + vsa_dss_2015_2_d.privat a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.abwasserbauwerk +( +t_id, zugaenglichkeit, baulos, detailgeometrie, finanzierung, bruttokosten, bezeichnung, inspektionsintervall, standortname, akten, bemerkung, sanierungsbedarf, wiederbeschaffungswert, wbw_basisjahr, wbw_bauart, status, baulicherzustand, subventionen, baujahr, ersatzjahr, eigentuemerref, betreiberref) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbauwerk', obj_id), +CASE WHEN accessibility = 3444 THEN 'ueberdeckt' ---- 3444 covered +WHEN accessibility = 3447 THEN 'unbekannt' ---- 3447 unknown +WHEN accessibility = 3446 THEN 'unzugaenglich' ---- 3446 inaccessible +WHEN accessibility = 3445 THEN 'zugaenglich' ---- 3445 accessible +END, contract_section, ST_Force2D(detail_geometry_geometry), +CASE WHEN financing = 5510 THEN 'oeffentlich' ---- 5510 public +WHEN financing = 5511 THEN 'privat' ---- 5511 private +WHEN financing = 5512 THEN 'unbekannt' ---- 5512 unknown +END, gross_costs, identifier, inspection_interval, location_name, records, remark, +CASE WHEN renovation_necessity = 5370 THEN 'dringend' ---- 5370 urgent +WHEN renovation_necessity = 5368 THEN 'keiner' ---- 5368 none +WHEN renovation_necessity = 2 THEN 'kurzfristig' ---- 2 short_term +WHEN renovation_necessity = 4 THEN 'langfristig' ---- 4 long_term +WHEN renovation_necessity = 3 THEN 'mittelfristig' ---- 3 medium_term +WHEN renovation_necessity = 5369 THEN 'unbekannt' ---- 5369 unknown +END, replacement_value, rv_base_year, +CASE WHEN rv_construction_type = 4602 THEN 'andere' ---- 4602 other +WHEN rv_construction_type = 4603 THEN 'Feld' ---- 4603 field +WHEN rv_construction_type = 4606 THEN 'Sanierungsleitung_Bagger' ---- 4606 renovation_conduction_excavator +WHEN rv_construction_type = 4605 THEN 'Sanierungsleitung_Grabenfraese' ---- 4605 renovation_conduction_ditch_cutter +WHEN rv_construction_type = 4604 THEN 'Strasse' ---- 4604 road +WHEN rv_construction_type = 4601 THEN 'unbekannt' ---- 4601 unknown +END, status, +CASE WHEN structure_condition = 3037 THEN 'unbekannt' ---- 3037 unknown +WHEN structure_condition = 3363 THEN 'Z0' ---- 3363 Z0 +WHEN structure_condition = 3359 THEN 'Z1' ---- 3359 Z1 +WHEN structure_condition = 3360 THEN 'Z2' ---- 3360 Z2 +WHEN structure_condition = 3361 THEN 'Z3' ---- 3361 Z3 +WHEN structure_condition = 3362 THEN 'Z4' ---- 3362 Z4 +END, subsidies, year_of_construction, year_of_replacement, vsa_dss_2015_2_d.tid_lookup('Organisation', fk_owner), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_operator) +FROM qgep_od.wastewater_structure; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbauwerk', qgep_od.wastewater_structure.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_wastewater_structure.last_modification, vsa_dss_2015_2_d.tid_lookup('abwasserbauwerk', qgep_od.wastewater_structure.obj_id) +FROM qgep_od.wastewater_structure + LEFT JOIN qgep_od.organisation as a ON od_wastewater_structure.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_wastewater_structure.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.kanal +( +t_id, bettung_umhuellung, verbindungsart, funktionhierarchisch, funktionhydraulisch, spuelintervall, rohrlaenge, nutzungsart_ist, nutzungsart_geplant) +SELECT vsa_dss_2015_2_d.tid_lookup('kanal', obj_id), +CASE WHEN bedding_encasement = 5325 THEN 'andere' ---- 5325 other +WHEN bedding_encasement = 5332 THEN 'erdverlegt' ---- 5332 in_soil +WHEN bedding_encasement = 5328 THEN 'in_Kanal_aufgehaengt' ---- 5328 in_channel_suspended +WHEN bedding_encasement = 5339 THEN 'in_Kanal_einbetoniert' ---- 5339 in_channel_concrete_casted +WHEN bedding_encasement = 5331 THEN 'in_Leitungsgang' ---- 5331 in_walk_in_passage +WHEN bedding_encasement = 5337 THEN 'in_Vortriebsrohr_Beton' ---- 5337 in_jacking_pipe_concrete +WHEN bedding_encasement = 5336 THEN 'in_Vortriebsrohr_Stahl' ---- 5336 in_jacking_pipe_steel +WHEN bedding_encasement = 5335 THEN 'Sand' ---- 5335 sand +WHEN bedding_encasement = 5333 THEN 'SIA_Typ1' ---- 5333 sia_type_1 +WHEN bedding_encasement = 5330 THEN 'SIA_Typ2' ---- 5330 sia_type_2 +WHEN bedding_encasement = 5334 THEN 'SIA_Typ3' ---- 5334 sia_type_3 +WHEN bedding_encasement = 5340 THEN 'SIA_Typ4' ---- 5340 sia_type_4 +WHEN bedding_encasement = 5327 THEN 'Sohlbrett' ---- 5327 bed_plank +WHEN bedding_encasement = 5329 THEN 'unbekannt' ---- 5329 unknown +END, +CASE WHEN connection_type = 5341 THEN 'andere' ---- 5341 other +WHEN connection_type = 190 THEN 'Elektroschweissmuffen' ---- 190 electric_welded_sleeves +WHEN connection_type = 187 THEN 'Flachmuffen' ---- 187 flat_sleeves +WHEN connection_type = 193 THEN 'Flansch' ---- 193 flange +WHEN connection_type = 185 THEN 'Glockenmuffen' ---- 185 bell_shaped_sleeves +WHEN connection_type = 192 THEN 'Kupplung' ---- 192 coupling +WHEN connection_type = 194 THEN 'Schraubmuffen' ---- 194 screwed_sleeves +WHEN connection_type = 189 THEN 'spiegelgeschweisst' ---- 189 butt_welded +WHEN connection_type = 186 THEN 'Spitzmuffen' ---- 186 beaked_sleeves +WHEN connection_type = 191 THEN 'Steckmuffen' ---- 191 push_fit_sleeves +WHEN connection_type = 188 THEN 'Ueberschiebmuffen' ---- 188 slip_on_sleeves +WHEN connection_type = 3036 THEN 'unbekannt' ---- 3036 unknown +WHEN connection_type = 3666 THEN 'Vortriebsrohrkupplung' ---- 3666 jacking_pipe_coupling +END, function_hierarchic, +CASE WHEN function_hydraulic = 5320 THEN 'andere' ---- 5320 other +WHEN function_hydraulic = 2546 THEN 'Drainagetransportleitung' ---- 2546 drainage_transportation_pipe +WHEN function_hydraulic = 22 THEN 'Drosselleitung' ---- 22 restriction_pipe +WHEN function_hydraulic = 3610 THEN 'Duekerleitung' ---- 3610 inverted_syphon +WHEN function_hydraulic = 367 THEN 'Freispiegelleitung' ---- 367 gravity_pipe +WHEN function_hydraulic = 23 THEN 'Pumpendruckleitung' ---- 23 pump_pressure_pipe +WHEN function_hydraulic = 145 THEN 'Sickerleitung' ---- 145 seepage_water_drain +WHEN function_hydraulic = 21 THEN 'Speicherleitung' ---- 21 retention_pipe +WHEN function_hydraulic = 144 THEN 'Spuelleitung' ---- 144 jetting_pipe +WHEN function_hydraulic = 5321 THEN 'unbekannt' ---- 5321 unknown +WHEN function_hydraulic = 3655 THEN 'Vakuumleitung' ---- 3655 vacuum_pipe +END, jetting_interval, pipe_length, +CASE WHEN usage_current = 5322 THEN 'andere' ---- 5322 other +WHEN usage_current = 4518 THEN 'Bachwasser' ---- 4518 creek_water +WHEN usage_current = 4516 THEN 'entlastetes_Mischabwasser' ---- 4516 discharged_combined_wastewater +WHEN usage_current = 4524 THEN 'Industrieabwasser' ---- 4524 industrial_wastewater +WHEN usage_current = 4522 THEN 'Mischabwasser' ---- 4522 combined_wastewater +WHEN usage_current = 4520 THEN 'Regenabwasser' ---- 4520 rain_wastewater +WHEN usage_current = 4514 THEN 'Reinabwasser' ---- 4514 clean_wastewater +WHEN usage_current = 4526 THEN 'Schmutzabwasser' ---- 4526 wastewater +WHEN usage_current = 4571 THEN 'unbekannt' ---- 4571 unknown +END, +CASE WHEN usage_planned = 5323 THEN 'andere' ---- 5323 other +WHEN usage_planned = 4519 THEN 'Bachwasser' ---- 4519 creek_water +WHEN usage_planned = 4517 THEN 'entlastetes_Mischabwasser' ---- 4517 discharged_combined_wastewater +WHEN usage_planned = 4525 THEN 'Industrieabwasser' ---- 4525 industrial_wastewater +WHEN usage_planned = 4523 THEN 'Mischabwasser' ---- 4523 combined_wastewater +WHEN usage_planned = 4521 THEN 'Regenabwasser' ---- 4521 rain_wastewater +WHEN usage_planned = 4515 THEN 'Reinabwasser' ---- 4515 clean_wastewater +WHEN usage_planned = 4527 THEN 'Schmutzabwasser' ---- 4527 wastewater +WHEN usage_planned = 4569 THEN 'unbekannt' ---- 4569 unknown +END +FROM qgep_od.channel; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'kanal' +FROM + vsa_dss_2015_2_d.kanal a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.normschacht +( +t_id, dimension1, dimension2, funktion, material, oberflaechenzulauf) +SELECT vsa_dss_2015_2_d.tid_lookup('normschacht', obj_id), dimension1, dimension2, +CASE WHEN function = 4532 THEN 'Absturzbauwerk' ---- 4532 drop_structure +WHEN function = 5344 THEN 'andere' ---- 5344 other +WHEN function = 4533 THEN 'Be_Entlueftung' ---- 4533 venting +WHEN function = 3267 THEN 'Dachwasserschacht' ---- 3267 rain_water_manhole +WHEN function = 3266 THEN 'Einlaufschacht' ---- 3266 gully +WHEN function = 3472 THEN 'Entwaesserungsrinne' ---- 3472 drainage_channel +WHEN function = 228 THEN 'Geleiseschacht' ---- 228 rail_track_gully +WHEN function = 204 THEN 'Kontrollschacht' ---- 204 manhole +WHEN function = 1008 THEN 'Oelabscheider' ---- 1008 oil_separator +WHEN function = 4536 THEN 'Pumpwerk' ---- 4536 pump_station +WHEN function = 5346 THEN 'Regenueberlauf' ---- 5346 stormwater_overflow +WHEN function = 2742 THEN 'Schlammsammler' ---- 2742 slurry_collector +WHEN function = 5347 THEN 'Schwimmstoffabscheider' ---- 5347 floating_material_separator +WHEN function = 4537 THEN 'Spuelschacht' ---- 4537 jetting_manhole +WHEN function = 4798 THEN 'Trennbauwerk' ---- 4798 separating_structure +WHEN function = 5345 THEN 'unbekannt' ---- 5345 unknown +END, +CASE WHEN material = 4540 THEN 'andere' ---- 4540 other +WHEN material = 4541 THEN 'Beton' ---- 4541 concrete +WHEN material = 4542 THEN 'Kunststoff' ---- 4542 plastic +WHEN material = 4543 THEN 'unbekannt' ---- 4543 unknown +END, +CASE WHEN surface_inflow = 5342 THEN 'andere' ---- 5342 other +WHEN surface_inflow = 2741 THEN 'keiner' ---- 2741 none +WHEN surface_inflow = 2739 THEN 'Rost' ---- 2739 grid +WHEN surface_inflow = 5343 THEN 'unbekannt' ---- 5343 unknown +WHEN surface_inflow = 2740 THEN 'Zulauf_seitlich' ---- 2740 intake_from_side +END +FROM qgep_od.manhole; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'normschacht' +FROM + vsa_dss_2015_2_d.normschacht a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.einleitstelle +( +t_id, hochwasserkote, relevanz, terrainkote, wasserspiegel_hydraulik, gewaessersektorref) +SELECT vsa_dss_2015_2_d.tid_lookup('einleitstelle', obj_id), highwater_level, +CASE WHEN relevance = 5580 THEN 'gewaesserrelevant' ---- 5580 relevant_for_water_course +WHEN relevance = 5581 THEN 'nicht_gewaesserrelevant' ---- 5581 non_relevant_for_water_course +END, terrain_level, waterlevel_hydraulic, vsa_dss_2015_2_d.tid_lookup('Gewaessersektor', fk_sector_water_body) +FROM qgep_od.discharge_point; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'einleitstelle' +FROM + vsa_dss_2015_2_d.einleitstelle a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.spezialbauwerk +( +t_id, bypass, notueberlauf, funktion, regenbecken_anordnung) +SELECT vsa_dss_2015_2_d.tid_lookup('spezialbauwerk', obj_id), +CASE WHEN bypass = 2682 THEN 'nicht_vorhanden' ---- 2682 inexistent +WHEN bypass = 3055 THEN 'unbekannt' ---- 3055 unknown +WHEN bypass = 2681 THEN 'vorhanden' ---- 2681 existent +END, +CASE WHEN emergency_spillway = 5866 THEN 'andere' ---- 5866 other +WHEN emergency_spillway = 5864 THEN 'inMischabwasserkanalisation' ---- 5864 in_combined_waste_water_drain +WHEN emergency_spillway = 5865 THEN 'inRegenabwasserkanalisation' ---- 5865 in_rain_waste_water_drain +WHEN emergency_spillway = 5863 THEN 'inSchmutzabwasserkanalisation' ---- 5863 in_waste_water_drain +WHEN emergency_spillway = 5878 THEN 'keiner' ---- 5878 none +WHEN emergency_spillway = 5867 THEN 'unbekannt' ---- 5867 unknown +END, +CASE WHEN function = 6397 THEN 'abflussloseGrube' ---- 6397 pit_without_drain +WHEN function = 245 THEN 'Absturzbauwerk' ---- 245 drop_structure +WHEN function = 6398 THEN 'Abwasserfaulraum' ---- 6398 hydrolizing_tank +WHEN function = 5371 THEN 'andere' ---- 5371 other +WHEN function = 386 THEN 'Be_Entlueftung' ---- 386 venting +WHEN function = 3234 THEN 'Duekerkammer' ---- 3234 inverse_syphon_chamber +WHEN function = 5091 THEN 'Duekeroberhaupt' ---- 5091 syphon_head +WHEN function = 6399 THEN 'Faulgrube' ---- 6399 septic_tank_two_chambers +WHEN function = 3348 THEN 'Gelaendemulde' ---- 3348 terrain_depression +WHEN function = 336 THEN 'Geschiebefang' ---- 336 bolders_bedload_catchement_dam +WHEN function = 5494 THEN 'Guellegrube' ---- 5494 cesspit +WHEN function = 6478 THEN 'Klaergrube' ---- 6478 septic_tank +WHEN function = 2998 THEN 'Kontrollschacht' ---- 2998 manhole +WHEN function = 2768 THEN 'Oelabscheider' ---- 2768 oil_separator +WHEN function = 246 THEN 'Pumpwerk' ---- 246 pump_station +WHEN function = 3673 THEN 'Regenbecken_Durchlaufbecken' ---- 3673 stormwater_tank_with_overflow +WHEN function = 3674 THEN 'Regenbecken_Fangbecken' ---- 3674 stormwater_tank_retaining_first_flush +WHEN function = 5574 THEN 'Regenbecken_Fangkanal' ---- 5574 stormwater_retaining_channel +WHEN function = 3675 THEN 'Regenbecken_Regenklaerbecken' ---- 3675 stormwater_sedimentation_tank +WHEN function = 3676 THEN 'Regenbecken_Regenrueckhaltebecken' ---- 3676 stormwater_retention_tank +WHEN function = 5575 THEN 'Regenbecken_Regenrueckhaltekanal' ---- 5575 stormwater_retention_channel +WHEN function = 5576 THEN 'Regenbecken_Stauraumkanal' ---- 5576 stormwater_storage_channel +WHEN function = 3677 THEN 'Regenbecken_Verbundbecken' ---- 3677 stormwater_composite_tank +WHEN function = 5372 THEN 'Regenueberlauf' ---- 5372 stormwater_overflow +WHEN function = 5373 THEN 'Schwimmstoffabscheider' ---- 5373 floating_material_separator +WHEN function = 383 THEN 'seitlicherZugang' ---- 383 side_access +WHEN function = 227 THEN 'Spuelschacht' ---- 227 jetting_manhole +WHEN function = 4799 THEN 'Trennbauwerk' ---- 4799 separating_structure +WHEN function = 3008 THEN 'unbekannt' ---- 3008 unknown +WHEN function = 2745 THEN 'Wirbelfallschacht' ---- 2745 vortex_manhole +END, +CASE WHEN stormwater_tank_arrangement = 4608 THEN 'Hauptschluss' ---- 4608 main_connection +WHEN stormwater_tank_arrangement = 4609 THEN 'Nebenschluss' ---- 4609 side_connection +WHEN stormwater_tank_arrangement = 4610 THEN 'unbekannt' ---- 4610 unknown +END +FROM qgep_od.special_structure; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'spezialbauwerk' +FROM + vsa_dss_2015_2_d.spezialbauwerk a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.versickerungsanlage +( +t_id, schluckvermoegen, maengel, dimension1, dimension2, gwdistanz, wirksameflaeche, notueberlauf, art, beschriftung, versickerungswasser, saugwagen, wasserdichtheit, grundwasserleiterref) +SELECT vsa_dss_2015_2_d.tid_lookup('versickerungsanlage', obj_id), absorption_capacity, +CASE WHEN defects = 5361 THEN 'keine' ---- 5361 none +WHEN defects = 3276 THEN 'unwesentliche' ---- 3276 marginal +WHEN defects = 3275 THEN 'wesentliche' ---- 3275 substantial +END, dimension1, dimension2, distance_to_aquifer, effective_area, +CASE WHEN emergency_spillway = 5365 THEN 'inMischwasserkanalisation' ---- 5365 in_combined_waste_water_drain +WHEN emergency_spillway = 3307 THEN 'inRegenwasserkanalisation' ---- 3307 in_rain_waste_water_drain +WHEN emergency_spillway = 3304 THEN 'inVorfluter' ---- 3304 in_water_body +WHEN emergency_spillway = 3303 THEN 'keiner' ---- 3303 none +WHEN emergency_spillway = 3305 THEN 'oberflaechlichausmuendend' ---- 3305 surface_discharge +WHEN emergency_spillway = 3308 THEN 'unbekannt' ---- 3308 unknown +END, +CASE WHEN kind = 3282 THEN 'andere_mit_Bodenpassage' ---- 3282 with_soil_passage +WHEN kind = 3285 THEN 'andere_ohne_Bodenpassage' ---- 3285 without_soil_passage +WHEN kind = 3279 THEN 'Flaechenfoermige_Versickerung' ---- 3279 surface_infiltration +WHEN kind = 277 THEN 'Kieskoerper' ---- 277 gravel_formation +WHEN kind = 3284 THEN 'Kombination_Schacht_Strang' ---- 3284 combination_manhole_pipe +WHEN kind = 3281 THEN 'MuldenRigolenversickerung' ---- 3281 swale_french_drain_infiltration +WHEN kind = 3087 THEN 'unbekannt' ---- 3087 unknown +WHEN kind = 3280 THEN 'Versickerung_ueber_die_Schulter' ---- 3280 percolation_over_the_shoulder +WHEN kind = 276 THEN 'Versickerungsbecken' ---- 276 infiltration_basin +WHEN kind = 278 THEN 'Versickerungsschacht' ---- 278 adsorbing_well +WHEN kind = 3283 THEN 'Versickerungsstrang_Galerie' ---- 3283 infiltration_pipe_sections_gallery +END, +CASE WHEN labeling = 5362 THEN 'beschriftet' ---- 5362 labeled +WHEN labeling = 5363 THEN 'nichtbeschriftet' ---- 5363 not_labeled +WHEN labeling = 5364 THEN 'unbekannt' ---- 5364 unknown +END, +CASE WHEN seepage_utilization = 274 THEN 'Regenabwasser' ---- 274 rain_water +WHEN seepage_utilization = 273 THEN 'Reinabwasser' ---- 273 clean_water +WHEN seepage_utilization = 5359 THEN 'unbekannt' ---- 5359 unknown +END, +CASE WHEN vehicle_access = 3289 THEN 'unbekannt' ---- 3289 unknown +WHEN vehicle_access = 3288 THEN 'unzugaenglich' ---- 3288 inaccessible +WHEN vehicle_access = 3287 THEN 'zugaenglich' ---- 3287 accessible +END, +CASE WHEN watertightness = 3295 THEN 'nichtwasserdicht' ---- 3295 not_watertight +WHEN watertightness = 5360 THEN 'unbekannt' ---- 5360 unknown +WHEN watertightness = 3294 THEN 'wasserdicht' ---- 3294 watertight +END, vsa_dss_2015_2_d.tid_lookup('Grundwasserleiter', fk_aquifier) +FROM qgep_od.infiltration_installation; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'versickerungsanlage' +FROM + vsa_dss_2015_2_d.versickerungsanlage a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.arabauwerk +( +t_id, art) +SELECT vsa_dss_2015_2_d.tid_lookup('arabauwerk', obj_id), +CASE WHEN kind = 331 THEN 'Absetzbecken' ---- 331 sedimentation_basin +WHEN kind = 2974 THEN 'andere' ---- 2974 other +WHEN kind = 327 THEN 'Belebtschlammbecken' ---- 327 aeration_tank +WHEN kind = 329 THEN 'Festbettreaktor' ---- 329 fixed_bed_reactor +WHEN kind = 330 THEN 'Tauchtropfkoerper' ---- 330 submerged_trickling_filter +WHEN kind = 328 THEN 'Tropfkoerper' ---- 328 trickling_filter +WHEN kind = 3032 THEN 'unbekannt' ---- 3032 unknown +WHEN kind = 326 THEN 'Vorklaerbecken' ---- 326 primary_clarifier +END +FROM qgep_od.wwtp_structure; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'arabauwerk' +FROM + vsa_dss_2015_2_d.arabauwerk a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.erhaltungsereignis +( +t_id, datengrundlage, kosten, detaildaten, dauer, bezeichnung, art, ausfuehrender, grund, bemerkung, ergebnis, status, zeitpunkt, +--abwasserbauwerkref, +--ausfuehrender_firmaref) +ausfuehrende_firmaref) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis', obj_id), base_data, cost, data_details, duration, identifier, +CASE WHEN kind = 2982 THEN 'andere' ---- 2982 other +WHEN kind = 120 THEN 'Erneuerung' ---- 120 replacement +WHEN kind = 28 THEN 'Reinigung' ---- 28 cleaning +WHEN kind = 4529 THEN 'Renovierung' ---- 4529 renovation +WHEN kind = 4528 THEN 'Reparatur' ---- 4528 repair +WHEN kind = 4530 THEN 'Sanierung' ---- 4530 restoration +WHEN kind = 3045 THEN 'unbekannt' ---- 3045 unknown +WHEN kind = 4564 THEN 'Untersuchung' ---- 4564 examination +END, operator, reason, remark, result, +CASE WHEN status = 2550 THEN 'ausgefuehrt' ---- 2550 accomplished +WHEN status = 2549 THEN 'geplant' ---- 2549 planned +WHEN status = 3678 THEN 'nicht_moeglich' ---- 3678 not_possible +WHEN status = 3047 THEN 'unbekannt' ---- 3047 unknown +END, time_point, +--vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure), +vsa_dss_2015_2_d.tid_lookup('Organisation', fk_operating_company) +FROM qgep_od.maintenance_event; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis', qgep_od.maintenance_event.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_maintenance_event.last_modification, vsa_dss_2015_2_d.tid_lookup('erhaltungsereignis', qgep_od.maintenance_event.obj_id) +FROM qgep_od.maintenance_event + LEFT JOIN qgep_od.organisation as a ON od_maintenance_event.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_maintenance_event.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.zone +( +t_id, bezeichnung, bemerkung) +SELECT vsa_dss_2015_2_d.tid_lookup('zone', obj_id), identifier, remark +FROM qgep_od.zone; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('zone', qgep_od.zone.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_zone.last_modification, vsa_dss_2015_2_d.tid_lookup('zone', qgep_od.zone.obj_id) +FROM qgep_od.zone + LEFT JOIN qgep_od.organisation as a ON od_zone.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_zone.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.planungszone +( +t_id, art, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('planungszone', obj_id), +CASE WHEN kind = 2990 THEN 'andere' ---- 2990 other +WHEN kind = 31 THEN 'Gewerbezone' ---- 31 commercial_zone +WHEN kind = 32 THEN 'Industriezone' ---- 32 industrial_zone +WHEN kind = 30 THEN 'Landwirtschaftszone' ---- 30 agricultural_zone +WHEN kind = 3077 THEN 'unbekannt' ---- 3077 unknown +WHEN kind = 29 THEN 'Wohnzone' ---- 29 residential_zone +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.planning_zone; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'planungszone' +FROM + vsa_dss_2015_2_d.planungszone a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.versickerungsbereich +( +t_id, versickerungsmoeglichkeit, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('versickerungsbereich', obj_id), +CASE WHEN infiltration_capacity = 371 THEN 'gut' ---- 371 good +WHEN infiltration_capacity = 374 THEN 'keine' ---- 374 none +WHEN infiltration_capacity = 372 THEN 'maessig' ---- 372 moderate +WHEN infiltration_capacity = 373 THEN 'schlecht' ---- 373 bad +WHEN infiltration_capacity = 3073 THEN 'unbekannt' ---- 3073 unknown +WHEN infiltration_capacity = 2996 THEN 'unzulaessig' ---- 2996 not_allowed +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.infiltration_zone; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'versickerungsbereich' +FROM + vsa_dss_2015_2_d.versickerungsbereich a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.entwaesserungssystem +( +t_id, art, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('entwaesserungssystem', obj_id), +CASE WHEN kind = 4783 THEN 'Melioration' ---- 4783 amelioration +WHEN kind = 2722 THEN 'Mischsystem' ---- 2722 mixed_system +WHEN kind = 2724 THEN 'ModifiziertesSystem' ---- 2724 modified_system +WHEN kind = 4544 THEN 'nicht_angeschlossen' ---- 4544 not_connected +WHEN kind = 2723 THEN 'Trennsystem' ---- 2723 separated_system +WHEN kind = 3060 THEN 'unbekannt' ---- 3060 unknown +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.drainage_system; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'entwaesserungssystem' +FROM + vsa_dss_2015_2_d.entwaesserungssystem a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gewaesserschutzbereich +( +t_id, art, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserschutzbereich', obj_id), +CASE WHEN kind = 430 THEN 'A' ---- 430 A +WHEN kind = 3652 THEN 'Ao' ---- 3652 Ao +WHEN kind = 3649 THEN 'Au' ---- 3649 Au +WHEN kind = 431 THEN 'B' ---- 431 B +WHEN kind = 432 THEN 'C' ---- 432 C +WHEN kind = 3069 THEN 'unbekannt' ---- 3069 unknown +WHEN kind = 3651 THEN 'Zo' ---- 3651 Zo +WHEN kind = 3650 THEN 'Zu' ---- 3650 Zu +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.water_body_protection_sector; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'gewaesserschutzbereich' +FROM + vsa_dss_2015_2_d.gewaesserschutzbereich a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.grundwasserschutzareal +( +t_id, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('grundwasserschutzareal', obj_id), ST_Force2D(perimeter_geometry) +FROM qgep_od.ground_water_protection_perimeter; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'grundwasserschutzareal' +FROM + vsa_dss_2015_2_d.grundwasserschutzareal a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.grundwasserschutzzone +( +t_id, art, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('grundwasserschutzzone', obj_id), +CASE WHEN kind = 440 THEN 'S1' ---- 440 S1 +WHEN kind = 441 THEN 'S2' ---- 441 S2 +WHEN kind = 442 THEN 'S3' ---- 442 S3 +WHEN kind = 3040 THEN 'unbekannt' ---- 3040 unknown +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.groundwater_protection_zone; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'grundwasserschutzzone' +FROM + vsa_dss_2015_2_d.grundwasserschutzzone a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.rohrprofil +( +t_id, hoehenbreitenverhaeltnis, bezeichnung, profiltyp, bemerkung) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil', obj_id), height_width_ratio, identifier, +CASE WHEN profile_type = 3351 THEN 'Eiprofil' ---- 3351 egg +WHEN profile_type = 3350 THEN 'Kreisprofil' ---- 3350 circle +WHEN profile_type = 3352 THEN 'Maulprofil' ---- 3352 mouth +WHEN profile_type = 3354 THEN 'offenes_Profil' ---- 3354 open +WHEN profile_type = 3353 THEN 'Rechteckprofil' ---- 3353 rectangular +WHEN profile_type = 3355 THEN 'Spezialprofil' ---- 3355 special +WHEN profile_type = 3357 THEN 'unbekannt' ---- 3357 unknown +END, remark +FROM qgep_od.pipe_profile; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil', qgep_od.pipe_profile.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_pipe_profile.last_modification, vsa_dss_2015_2_d.tid_lookup('rohrprofil', qgep_od.pipe_profile.obj_id) +FROM qgep_od.pipe_profile + LEFT JOIN qgep_od.organisation as a ON od_pipe_profile.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_pipe_profile.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.araenergienutzung +( +t_id, gasmotor, waermepumpe, bezeichnung, bemerkung, turbinierung, abwasserreinigungsanlageref) +SELECT vsa_dss_2015_2_d.tid_lookup('araenergienutzung', obj_id), gas_motor, heat_pump, identifier, remark, turbining, vsa_dss_2015_2_d.tid_lookup('Abwasserreinigungsanlage', fk_waste_water_treatment_plant) +FROM qgep_od.wwtp_energy_use; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('araenergienutzung', qgep_od.wwtp_energy_use.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_wwtp_energy_use.last_modification, vsa_dss_2015_2_d.tid_lookup('araenergienutzung', qgep_od.wwtp_energy_use.obj_id) +FROM qgep_od.wwtp_energy_use + LEFT JOIN qgep_od.organisation as a ON od_wwtp_energy_use.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_wwtp_energy_use.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.abwasserbehandlung +( +t_id, bezeichnung, art, bemerkung, abwasserreinigungsanlageref) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbehandlung', obj_id), identifier, +CASE WHEN kind = 3210 THEN 'andere' ---- 3210 other +WHEN kind = 387 THEN 'biologisch' ---- 387 biological +WHEN kind = 388 THEN 'chemisch' ---- 388 chemical +WHEN kind = 389 THEN 'Filtration' ---- 389 filtration +WHEN kind = 366 THEN 'mechanisch' ---- 366 mechanical +WHEN kind = 3076 THEN 'unbekannt' ---- 3076 unknown +END, remark, vsa_dss_2015_2_d.tid_lookup('Abwasserreinigungsanlage', fk_waste_water_treatment_plant) +FROM qgep_od.waste_water_treatment; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserbehandlung', qgep_od.waste_water_treatment.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_waste_water_treatment.last_modification, vsa_dss_2015_2_d.tid_lookup('abwasserbehandlung', qgep_od.waste_water_treatment.obj_id) +FROM qgep_od.waste_water_treatment + LEFT JOIN qgep_od.organisation as a ON od_waste_water_treatment.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_waste_water_treatment.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.schlammbehandlung +( +t_id, kompostierung, entwaesserung, faulschlammverbrennung, trocknung, frischschlammverbrennung, hygienisierung, bezeichnung, ueberschusschlammvoreindickung, mischschlammvoreindickung, primaerschlammvoreindickung, bemerkung, stabilisierung, entwaessertklaerschlammstapelung, fluessigklaerschlammstapelung, abwasserreinigungsanlageref) +SELECT vsa_dss_2015_2_d.tid_lookup('schlammbehandlung', obj_id), composting, dehydration, digested_sludge_combustion, drying, fresh_sludge_combustion, hygenisation, identifier, predensification_of_excess_sludge, predensification_of_mixed_sludge, predensification_of_primary_sludge, remark, +CASE WHEN stabilisation = 141 THEN 'aerobkalt' ---- 141 aerob_cold +WHEN stabilisation = 332 THEN 'aerobthermophil' ---- 332 aerobthermophil +WHEN stabilisation = 333 THEN 'anaerobkalt' ---- 333 anaerob_cold +WHEN stabilisation = 334 THEN 'anaerobmesophil' ---- 334 anaerob_mesophil +WHEN stabilisation = 335 THEN 'anaerobthermophil' ---- 335 anaerob_thermophil +WHEN stabilisation = 2994 THEN 'andere' ---- 2994 other +WHEN stabilisation = 3004 THEN 'unbekannt' ---- 3004 unknown +END, stacking_of_dehydrated_sludge, stacking_of_liquid_sludge, vsa_dss_2015_2_d.tid_lookup('Abwasserreinigungsanlage', fk_waste_water_treatment_plant) +FROM qgep_od.sludge_treatment; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('schlammbehandlung', qgep_od.sludge_treatment.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_sludge_treatment.last_modification, vsa_dss_2015_2_d.tid_lookup('schlammbehandlung', qgep_od.sludge_treatment.obj_id) +FROM qgep_od.sludge_treatment + LEFT JOIN qgep_od.organisation as a ON od_sludge_treatment.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_sludge_treatment.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.steuerungszentrale +( +t_id, bezeichnung, lage) +SELECT vsa_dss_2015_2_d.tid_lookup('steuerungszentrale', obj_id), identifier, ST_Force2D(situation_geometry) +FROM qgep_od.control_center; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('steuerungszentrale', qgep_od.control_center.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_control_center.last_modification, vsa_dss_2015_2_d.tid_lookup('steuerungszentrale', qgep_od.control_center.obj_id) +FROM qgep_od.control_center + LEFT JOIN qgep_od.organisation as a ON od_control_center.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_control_center.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.gewaesserverbauung +( +t_id, bezeichnung, bemerkung, lage, gewaesserabschnittref) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserverbauung', obj_id), identifier, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Gewaesserabschnitt', fk_water_course_segment) +FROM qgep_od.water_control_structure; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserverbauung', qgep_od.water_control_structure.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_water_control_structure.last_modification, vsa_dss_2015_2_d.tid_lookup('gewaesserverbauung', qgep_od.water_control_structure.obj_id) +FROM qgep_od.water_control_structure + LEFT JOIN qgep_od.organisation as a ON od_water_control_structure.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_water_control_structure.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.furt +( +t_id) +SELECT vsa_dss_2015_2_d.tid_lookup('furt', obj_id) +FROM qgep_od.ford; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'furt' +FROM + vsa_dss_2015_2_d.furt a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gewaesserabsturz +( +t_id, typ, material, absturzhoehe) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserabsturz', obj_id), +CASE WHEN kind = 3591 THEN 'kuenstlich' ---- 3591 artificial +WHEN kind = 3592 THEN 'natuerlich' ---- 3592 natural +WHEN kind = 3593 THEN 'unbekannt' ---- 3593 unknown +END, +CASE WHEN material = 2633 THEN 'andere' ---- 2633 other +WHEN material = 409 THEN 'Beton_Steinpflaesterung' ---- 409 concrete_or_rock_pavement +WHEN material = 411 THEN 'Fels_Steinbloecke' ---- 411 rocks_or_boulders +WHEN material = 408 THEN 'Holz' ---- 408 wood +WHEN material = 410 THEN 'natuerlich_kein' ---- 410 natural_none +WHEN material = 3061 THEN 'unbekannt' ---- 3061 unknown +END, vertical_drop +FROM qgep_od.chute; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'gewaesserabsturz' +FROM + vsa_dss_2015_2_d.gewaesserabsturz a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.schleuse +( +t_id, absturzhoehe) +SELECT vsa_dss_2015_2_d.tid_lookup('schleuse', obj_id), vertical_drop +FROM qgep_od.lock; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'schleuse' +FROM + vsa_dss_2015_2_d.schleuse a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.durchlass +( +t_id) +SELECT vsa_dss_2015_2_d.tid_lookup('durchlass', obj_id) +FROM qgep_od.passage; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'durchlass' +FROM + vsa_dss_2015_2_d.durchlass a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.geschiebesperre +( +t_id, absturzhoehe) +SELECT vsa_dss_2015_2_d.tid_lookup('geschiebesperre', obj_id), vertical_drop +FROM qgep_od.blocking_debris; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'geschiebesperre' +FROM + vsa_dss_2015_2_d.geschiebesperre a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gewaesserwehr +( +t_id, art, absturzhoehe) +SELECT vsa_dss_2015_2_d.tid_lookup('gewaesserwehr', obj_id), +CASE WHEN kind = 416 THEN 'Stauwehr' ---- 416 retaining_weir +WHEN kind = 417 THEN 'Streichwehr' ---- 417 spillway +WHEN kind = 419 THEN 'Talsperre' ---- 419 dam +WHEN kind = 418 THEN 'Tirolerwehr' ---- 418 tyrolean_weir +WHEN kind = 3064 THEN 'unbekannt' ---- 3064 unknown +END, vertical_drop +FROM qgep_od.dam; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'gewaesserwehr' +FROM + vsa_dss_2015_2_d.gewaesserwehr a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.sohlrampe +( +t_id, befestigung, absturzhoehe) +SELECT vsa_dss_2015_2_d.tid_lookup('sohlrampe', obj_id), +CASE WHEN stabilisation = 2635 THEN 'andere_glatt' ---- 2635 other_smooth +WHEN stabilisation = 2634 THEN 'andere_rauh' ---- 2634 other_rough +WHEN stabilisation = 415 THEN 'Betonrinne' ---- 415 concrete_channel +WHEN stabilisation = 412 THEN 'Blockwurf' ---- 412 rocks_or_boulders +WHEN stabilisation = 413 THEN 'gepflaestert' ---- 413 paved +WHEN stabilisation = 414 THEN 'Holzbalken' ---- 414 wooden_beam +WHEN stabilisation = 3063 THEN 'unbekannt' ---- 3063 unknown +END, vertical_drop +FROM qgep_od.rock_ramp; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'sohlrampe' +FROM + vsa_dss_2015_2_d.sohlrampe a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.fischpass +( +t_id, bezeichnung, bemerkung, absturzhoehe, gewaesserverbauungref) +SELECT vsa_dss_2015_2_d.tid_lookup('fischpass', obj_id), identifier, remark, vertical_drop, vsa_dss_2015_2_d.tid_lookup('Gewaesserverbauung', fk_water_control_structure) +FROM qgep_od.fish_pass; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('fischpass', qgep_od.fish_pass.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_fish_pass.last_modification, vsa_dss_2015_2_d.tid_lookup('fischpass', qgep_od.fish_pass.obj_id) +FROM qgep_od.fish_pass + LEFT JOIN qgep_od.organisation as a ON od_fish_pass.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_fish_pass.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.badestelle +( +t_id, bezeichnung, bemerkung, lage, oberflaechengewaesserref) +SELECT vsa_dss_2015_2_d.tid_lookup('badestelle', obj_id), identifier, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Oberflaechengewaesser', fk_chute) +FROM qgep_od.bathing_area; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('badestelle', qgep_od.bathing_area.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_bathing_area.last_modification, vsa_dss_2015_2_d.tid_lookup('badestelle', qgep_od.bathing_area.obj_id) +FROM qgep_od.bathing_area + LEFT JOIN qgep_od.organisation as a ON od_bathing_area.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_bathing_area.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.hydr_geometrie +( +t_id, bezeichnung, bemerkung, stauraum, nutzinhalt_fangteil, nutzinhalt_klaerteil, nutzinhalt, volumen_pumpensumpf) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geometrie', obj_id), identifier, remark, storage_volume, usable_capacity_storage, usable_capacity_treatment, utilisable_capacity, volume_pump_sump +FROM qgep_od.hydr_geometry; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geometrie', qgep_od.hydr_geometry.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_hydr_geometry.last_modification, vsa_dss_2015_2_d.tid_lookup('hydr_geometrie', qgep_od.hydr_geometry.obj_id) +FROM qgep_od.hydr_geometry + LEFT JOIN qgep_od.organisation as a ON od_hydr_geometry.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_hydr_geometry.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.abwassernetzelement +( +t_id, bezeichnung, bemerkung, abwasserbauwerkref) +SELECT vsa_dss_2015_2_d.tid_lookup('abwassernetzelement', obj_id), identifier, remark, vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure) +FROM qgep_od.wastewater_networkelement; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('abwassernetzelement', qgep_od.wastewater_networkelement.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_wastewater_networkelement.last_modification, vsa_dss_2015_2_d.tid_lookup('abwassernetzelement', qgep_od.wastewater_networkelement.obj_id) +FROM qgep_od.wastewater_networkelement + LEFT JOIN qgep_od.organisation as a ON od_wastewater_networkelement.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_wastewater_networkelement.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.haltungspunkt +( +t_id, hoehengenauigkeit, bezeichnung, kote, auslaufform, lage_anschluss, bemerkung, lage, abwassernetzelementref) +SELECT vsa_dss_2015_2_d.tid_lookup('haltungspunkt', obj_id), +CASE WHEN elevation_accuracy = 3248 THEN 'groesser_6cm' ---- 3248 more_than_6cm +WHEN elevation_accuracy = 3245 THEN 'plusminus_1cm' ---- 3245 plusminus_1cm +WHEN elevation_accuracy = 3246 THEN 'plusminus_3cm' ---- 3246 plusminus_3cm +WHEN elevation_accuracy = 3247 THEN 'plusminus_6cm' ---- 3247 plusminus_6cm +WHEN elevation_accuracy = 5376 THEN 'unbekannt' ---- 5376 unknown +END, identifier, level, +CASE WHEN outlet_shape = 5374 THEN 'abgerundet' ---- 5374 round_edged +WHEN outlet_shape = 298 THEN 'blendenfoermig' ---- 298 orifice +WHEN outlet_shape = 3358 THEN 'keine_Querschnittsaenderung' ---- 3358 no_cross_section_change +WHEN outlet_shape = 286 THEN 'scharfkantig' ---- 286 sharp_edged +WHEN outlet_shape = 5375 THEN 'unbekannt' ---- 5375 unknown +END, position_of_connection, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement) +FROM qgep_od.reach_point; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('haltungspunkt', qgep_od.reach_point.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_reach_point.last_modification, vsa_dss_2015_2_d.tid_lookup('haltungspunkt', qgep_od.reach_point.obj_id) +FROM qgep_od.reach_point + LEFT JOIN qgep_od.organisation as a ON od_reach_point.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_reach_point.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.abwasserknoten +( +t_id, rueckstaukote, sohlenkote, lage, hydr_geometrieref) +SELECT vsa_dss_2015_2_d.tid_lookup('abwasserknoten', obj_id), backflow_level, bottom_level, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Hydr_Geometrie', fk_hydr_geometry) +FROM qgep_od.wastewater_node; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'abwasserknoten' +FROM + vsa_dss_2015_2_d.abwasserknoten a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.haltung +( +t_id, lichte_hoehe, reibungsbeiwert, lagebestimmung, innenschutz, laengeeffektiv, material, verlauf, reliner_material, reliner_nennweite, reliner_bautechnik, reliner_art, ringsteifigkeit, plangefaelle, wandrauhigkeit, vonhaltungspunktref, nachhaltungspunktref, rohrprofilref) +SELECT vsa_dss_2015_2_d.tid_lookup('haltung', obj_id), clear_height, coefficient_of_friction, +CASE WHEN horizontal_positioning = 5378 THEN 'genau' ---- 5378 accurate +WHEN horizontal_positioning = 5379 THEN 'unbekannt' ---- 5379 unknown +WHEN horizontal_positioning = 5380 THEN 'ungenau' ---- 5380 inaccurate +END, +CASE WHEN inside_coating = 5383 THEN 'andere' ---- 5383 other +WHEN inside_coating = 248 THEN 'Anstrich_Beschichtung' ---- 248 coating +WHEN inside_coating = 250 THEN 'Kanalklinkerauskleidung' ---- 250 brick_lining +WHEN inside_coating = 251 THEN 'Steinzeugauskleidung' ---- 251 stoneware_lining +WHEN inside_coating = 5384 THEN 'unbekannt' ---- 5384 unknown +WHEN inside_coating = 249 THEN 'Zementmoertelauskleidung' ---- 249 cement_mortar_lining +END, length_effective, +CASE WHEN material = 5381 THEN 'andere' ---- 5381 other +WHEN material = 2754 THEN 'Asbestzement' ---- 2754 asbestos_cement +WHEN material = 3638 THEN 'Beton_Normalbeton' ---- 3638 concrete_normal +WHEN material = 3639 THEN 'Beton_Ortsbeton' ---- 3639 concrete_insitu +WHEN material = 3640 THEN 'Beton_Pressrohrbeton' ---- 3640 concrete_presspipe +WHEN material = 3641 THEN 'Beton_Spezialbeton' ---- 3641 concrete_special +WHEN material = 3256 THEN 'Beton_unbekannt' ---- 3256 concrete_unknown +WHEN material = 147 THEN 'Faserzement' ---- 147 fiber_cement +WHEN material = 2755 THEN 'Gebrannte_Steine' ---- 2755 bricks +WHEN material = 148 THEN 'Guss_duktil' ---- 148 cast_ductile_iron +WHEN material = 3648 THEN 'Guss_Grauguss' ---- 3648 cast_gray_iron +WHEN material = 5076 THEN 'Kunststoff_Epoxydharz' ---- 5076 plastic_epoxy_resin +WHEN material = 5077 THEN 'Kunststoff_Hartpolyethylen' ---- 5077 plastic_highdensity_polyethylene +WHEN material = 5078 THEN 'Kunststoff_Polyester_GUP' ---- 5078 plastic_polyester_GUP +WHEN material = 5079 THEN 'Kunststoff_Polyethylen' ---- 5079 plastic_polyethylene +WHEN material = 5080 THEN 'Kunststoff_Polypropylen' ---- 5080 plastic_polypropylene +WHEN material = 5081 THEN 'Kunststoff_Polyvinilchlorid' ---- 5081 plastic_PVC +WHEN material = 5382 THEN 'Kunststoff_unbekannt' ---- 5382 plastic_unknown +WHEN material = 153 THEN 'Stahl' ---- 153 steel +WHEN material = 3654 THEN 'Stahl_rostfrei' ---- 3654 steel_stainless +WHEN material = 154 THEN 'Steinzeug' ---- 154 stoneware +WHEN material = 2761 THEN 'Ton' ---- 2761 clay +WHEN material = 3016 THEN 'unbekannt' ---- 3016 unknown +WHEN material = 2762 THEN 'Zement' ---- 2762 cement +END, ST_Force2D(progression_geometry), +CASE WHEN reliner_material = 6459 THEN 'andere' ---- 6459 other +WHEN reliner_material = 6461 THEN 'Epoxidharz_Glasfaserlaminat' ---- 6461 epoxy_resin_glass_fibre_laminate +WHEN reliner_material = 6460 THEN 'Epoxidharz_Kunststofffilz' ---- 6460 epoxy_resin_plastic_felt +WHEN reliner_material = 6483 THEN 'GUP_Rohr' ---- 6483 GUP_pipe +WHEN reliner_material = 6462 THEN 'HDPE' ---- 6462 HDPE +WHEN reliner_material = 6484 THEN 'Isocyanatharze_Glasfaserlaminat' ---- 6484 isocyanate_resin_glass_fibre_laminate +WHEN reliner_material = 6485 THEN 'Isocyanatharze_Kunststofffilz' ---- 6485 isocyanate_resin_plastic_felt +WHEN reliner_material = 6464 THEN 'Polyesterharz_Glasfaserlaminat' ---- 6464 polyester_resin_glass_fibre_laminate +WHEN reliner_material = 6463 THEN 'Polyesterharz_Kunststofffilz' ---- 6463 polyester_resin_plastic_felt +WHEN reliner_material = 6482 THEN 'Polypropylen' ---- 6482 polypropylene +WHEN reliner_material = 6465 THEN 'Polyvinilchlorid' ---- 6465 PVC +WHEN reliner_material = 6466 THEN 'Sohle_mit_Schale_aus_Polyesterbeton' ---- 6466 bottom_with_polyester_concret_shell +WHEN reliner_material = 6467 THEN 'unbekannt' ---- 6467 unknown +WHEN reliner_material = 6486 THEN 'UP_Harz_LED_Synthesefaserliner' ---- 6486 UP_resin_LED_synthetic_fibre_liner +WHEN reliner_material = 6468 THEN 'Vinylesterharz_Glasfaserlaminat' ---- 6468 vinyl_ester_resin_glass_fibre_laminate +WHEN reliner_material = 6469 THEN 'Vinylesterharz_Kunststofffilz' ---- 6469 vinyl_ester_resin_plastic_felt +END, reliner_nominal_size, +CASE WHEN relining_construction = 6448 THEN 'andere' ---- 6448 other +WHEN relining_construction = 6479 THEN 'Close_Fit_Relining' ---- 6479 close_fit_relining +WHEN relining_construction = 6449 THEN 'Kurzrohrrelining' ---- 6449 relining_short_tube +WHEN relining_construction = 6481 THEN 'Noppenschlauchrelining' ---- 6481 grouted_in_place_lining +WHEN relining_construction = 6452 THEN 'Partieller_Liner' ---- 6452 partial_liner +WHEN relining_construction = 6450 THEN 'Rohrstrangrelining' ---- 6450 pipe_string_relining +WHEN relining_construction = 6451 THEN 'Schlauchrelining' ---- 6451 hose_relining +WHEN relining_construction = 6453 THEN 'unbekannt' ---- 6453 unknown +WHEN relining_construction = 6480 THEN 'Wickelrohrrelining' ---- 6480 spiral_lining +END, +CASE WHEN relining_kind = 6455 THEN 'ganze_Haltung' ---- 6455 full_reach +WHEN relining_kind = 6456 THEN 'partiell' ---- 6456 partial +WHEN relining_kind = 6457 THEN 'unbekannt' ---- 6457 unknown +END, ring_stiffness, slope_building_plan, wall_roughness, vsa_dss_2015_2_d.tid_lookup('Haltungspunkt', fk_reach_point_from), vsa_dss_2015_2_d.tid_lookup('Haltungspunkt', fk_reach_point_to), vsa_dss_2015_2_d.tid_lookup('Rohrprofil', fk_pipe_profile) +FROM qgep_od.reach; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'haltung' +FROM + vsa_dss_2015_2_d.haltung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.rohrprofil_geometrie +( +t_id, aposition, x, y, rohrprofilref) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil_geometrie', obj_id), position, x, y, vsa_dss_2015_2_d.tid_lookup('Rohrprofil', fk_pipe_profile) +FROM qgep_od.profile_geometry; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('rohrprofil_geometrie', qgep_od.profile_geometry.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_profile_geometry.last_modification, vsa_dss_2015_2_d.tid_lookup('rohrprofil_geometrie', qgep_od.profile_geometry.obj_id) +FROM qgep_od.profile_geometry + LEFT JOIN qgep_od.organisation as a ON od_profile_geometry.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_profile_geometry.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.hydr_geomrelation +( +t_id, wassertiefe, wasseroberflaeche, benetztequerschnittsflaeche, hydr_geometrieref) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geomrelation', obj_id), water_depth, water_surface, wet_cross_section_area, vsa_dss_2015_2_d.tid_lookup('Hydr_Geometrie', fk_hydr_geometry) +FROM qgep_od.hydr_geom_relation; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_geomrelation', qgep_od.hydr_geom_relation.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_hydr_geom_relation.last_modification, vsa_dss_2015_2_d.tid_lookup('hydr_geomrelation', qgep_od.hydr_geom_relation.obj_id) +FROM qgep_od.hydr_geom_relation + LEFT JOIN qgep_od.organisation as a ON od_hydr_geom_relation.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_hydr_geom_relation.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.mechanischevorreinigung +( +t_id, bezeichnung, art, bemerkung, versickerungsanlageref, abwasserbauwerkref) +SELECT vsa_dss_2015_2_d.tid_lookup('mechanischevorreinigung', obj_id), identifier, +CASE WHEN kind = 3317 THEN 'Filtersack' ---- 3317 filter_bag +WHEN kind = 3319 THEN 'KuenstlicherAdsorber' ---- 3319 artificial_adsorber +WHEN kind = 3318 THEN 'MuldenRigolenSystem' ---- 3318 swale_french_drain_system +WHEN kind = 3320 THEN 'Schlammsammler' ---- 3320 slurry_collector +WHEN kind = 3321 THEN 'Schwimmstoffabscheider' ---- 3321 floating_matter_separator +WHEN kind = 3322 THEN 'unbekannt' ---- 3322 unknown +END, remark, vsa_dss_2015_2_d.tid_lookup('Versickerungsanlage', fk_infiltration_installation), vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure) +FROM qgep_od.mechanical_pretreatment; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('mechanischevorreinigung', qgep_od.mechanical_pretreatment.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_mechanical_pretreatment.last_modification, vsa_dss_2015_2_d.tid_lookup('mechanischevorreinigung', qgep_od.mechanical_pretreatment.obj_id) +FROM qgep_od.mechanical_pretreatment + LEFT JOIN qgep_od.organisation as a ON od_mechanical_pretreatment.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_mechanical_pretreatment.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.retentionskoerper +( +t_id, bezeichnung, art, bemerkung, retention_volumen, versickerungsanlageref) +SELECT vsa_dss_2015_2_d.tid_lookup('retentionskoerper', obj_id), identifier, +CASE WHEN kind = 2992 THEN 'andere' ---- 2992 other +WHEN kind = 346 THEN 'Biotop' ---- 346 retention_in_habitat +WHEN kind = 345 THEN 'Dachretention' ---- 345 roof_retention +WHEN kind = 348 THEN 'Parkplatz' ---- 348 parking_lot +WHEN kind = 347 THEN 'Staukanal' ---- 347 accumulation_channel +WHEN kind = 3031 THEN 'unbekannt' ---- 3031 unknown +END, remark, volume, vsa_dss_2015_2_d.tid_lookup('Versickerungsanlage', fk_infiltration_installation) +FROM qgep_od.retention_body; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('retentionskoerper', qgep_od.retention_body.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_retention_body.last_modification, vsa_dss_2015_2_d.tid_lookup('retentionskoerper', qgep_od.retention_body.obj_id) +FROM qgep_od.retention_body + LEFT JOIN qgep_od.organisation as a ON od_retention_body.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_retention_body.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.ueberlaufcharakteristik +( +t_id, bezeichnung, kennlinie_typ, kennlinie_digital, bemerkung) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlaufcharakteristik', obj_id), identifier, +CASE WHEN kind_overflow_characteristic = 6220 THEN 'HQ' ---- 6220 hq +WHEN kind_overflow_characteristic = 6221 THEN 'QQ' ---- 6221 qq +WHEN kind_overflow_characteristic = 6228 THEN 'unbekannt' ---- 6228 unknown +END, +CASE WHEN overflow_characteristic_digital = 6223 THEN 'ja' ---- 6223 yes +WHEN overflow_characteristic_digital = 6224 THEN 'nein' ---- 6224 no +WHEN overflow_characteristic_digital = 6225 THEN 'unbekannt' ---- 6225 unknown +END, remark +FROM qgep_od.overflow_characteristic; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlaufcharakteristik', qgep_od.overflow_characteristic.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_overflow_characteristic.last_modification, vsa_dss_2015_2_d.tid_lookup('ueberlaufcharakteristik', qgep_od.overflow_characteristic.obj_id) +FROM qgep_od.overflow_characteristic + LEFT JOIN qgep_od.organisation as a ON od_overflow_characteristic.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_overflow_characteristic.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.hq_relation +( +t_id, hoehe, abfluss, zufluss, ueberlaufcharakteristikref) +SELECT vsa_dss_2015_2_d.tid_lookup('hq_relation', obj_id), altitude, flow, flow_from, vsa_dss_2015_2_d.tid_lookup('Ueberlaufcharakteristik', fk_overflow_characteristic) +FROM qgep_od.hq_relation; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('hq_relation', qgep_od.hq_relation.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_hq_relation.last_modification, vsa_dss_2015_2_d.tid_lookup('hq_relation', qgep_od.hq_relation.obj_id) +FROM qgep_od.hq_relation + LEFT JOIN qgep_od.organisation as a ON od_hq_relation.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_hq_relation.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.bauwerksteil +( +t_id, bezeichnung, bemerkung, instandstellung, abwasserbauwerkref) +SELECT vsa_dss_2015_2_d.tid_lookup('bauwerksteil', obj_id), identifier, remark, +CASE WHEN renovation_demand = 138 THEN 'nicht_notwendig' ---- 138 not_necessary +WHEN renovation_demand = 137 THEN 'notwendig' ---- 137 necessary +WHEN renovation_demand = 5358 THEN 'unbekannt' ---- 5358 unknown +END, vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure) +FROM qgep_od.structure_part; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('bauwerksteil', qgep_od.structure_part.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_structure_part.last_modification, vsa_dss_2015_2_d.tid_lookup('bauwerksteil', qgep_od.structure_part.obj_id) +FROM qgep_od.structure_part + LEFT JOIN qgep_od.organisation as a ON od_structure_part.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_structure_part.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.trockenwetterfallrohr +( +t_id, durchmesser) +SELECT vsa_dss_2015_2_d.tid_lookup('trockenwetterfallrohr', obj_id), diameter +FROM qgep_od.dryweather_downspout; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'trockenwetterfallrohr' +FROM + vsa_dss_2015_2_d.trockenwetterfallrohr a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.einstiegshilfe +( +t_id, art) +SELECT vsa_dss_2015_2_d.tid_lookup('einstiegshilfe', obj_id), +CASE WHEN kind = 5357 THEN 'andere' ---- 5357 other +WHEN kind = 243 THEN 'Drucktuere' ---- 243 pressurized_door +WHEN kind = 92 THEN 'keine' ---- 92 none +WHEN kind = 240 THEN 'Leiter' ---- 240 ladder +WHEN kind = 241 THEN 'Steigeisen' ---- 241 step_iron +WHEN kind = 3473 THEN 'Treppe' ---- 3473 staircase +WHEN kind = 91 THEN 'Trittnischen' ---- 91 footstep_niches +WHEN kind = 3230 THEN 'Tuere' ---- 3230 door +WHEN kind = 3048 THEN 'unbekannt' ---- 3048 unknown +END +FROM qgep_od.access_aid; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'einstiegshilfe' +FROM + vsa_dss_2015_2_d.einstiegshilfe a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.trockenwetterrinne +( +t_id, material) +SELECT vsa_dss_2015_2_d.tid_lookup('trockenwetterrinne', obj_id), +CASE WHEN material = 3221 THEN 'andere' ---- 3221 other +WHEN material = 354 THEN 'kombiniert' ---- 354 combined +WHEN material = 5356 THEN 'Kunststoff' ---- 5356 plastic +WHEN material = 238 THEN 'Steinzeug' ---- 238 stoneware +WHEN material = 3017 THEN 'unbekannt' ---- 3017 unknown +WHEN material = 237 THEN 'Zementmoertel' ---- 237 cement_mortar +END +FROM qgep_od.dryweather_flume; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'trockenwetterrinne' +FROM + vsa_dss_2015_2_d.trockenwetterrinne a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.deckel +( +t_id, fabrikat, deckelform, durchmesser, verschluss, kote, material, lagegenauigkeit, lage, schlammeimer, entlueftung) +SELECT vsa_dss_2015_2_d.tid_lookup('deckel', obj_id), brand, +CASE WHEN cover_shape = 5353 THEN 'andere' ---- 5353 other +WHEN cover_shape = 3499 THEN 'eckig' ---- 3499 rectangular +WHEN cover_shape = 3498 THEN 'rund' ---- 3498 round +WHEN cover_shape = 5354 THEN 'unbekannt' ---- 5354 unknown +END, diameter, +CASE WHEN fastening = 5350 THEN 'nicht_verschraubt' ---- 5350 not_bolted +WHEN fastening = 5351 THEN 'unbekannt' ---- 5351 unknown +WHEN fastening = 5352 THEN 'verschraubt' ---- 5352 bolted +END, level, +CASE WHEN material = 5355 THEN 'andere' ---- 5355 other +WHEN material = 234 THEN 'Beton' ---- 234 concrete +WHEN material = 233 THEN 'Guss' ---- 233 cast_iron +WHEN material = 5547 THEN 'Guss_mit_Belagsfuellung' ---- 5547 cast_iron_with_pavement_filling +WHEN material = 235 THEN 'Guss_mit_Betonfuellung' ---- 235 cast_iron_with_concrete_filling +WHEN material = 3015 THEN 'unbekannt' ---- 3015 unknown +END, +CASE WHEN positional_accuracy = 3243 THEN 'groesser_50cm' ---- 3243 more_than_50cm +WHEN positional_accuracy = 3241 THEN 'plusminus_10cm' ---- 3241 plusminus_10cm +WHEN positional_accuracy = 3236 THEN 'plusminus_3cm' ---- 3236 plusminus_3cm +WHEN positional_accuracy = 3242 THEN 'plusminus_50cm' ---- 3242 plusminus_50cm +WHEN positional_accuracy = 5349 THEN 'unbekannt' ---- 5349 unknown +END, ST_Force2D(situation_geometry), +CASE WHEN sludge_bucket = 423 THEN 'nicht_vorhanden' ---- 423 inexistent +WHEN sludge_bucket = 3066 THEN 'unbekannt' ---- 3066 unknown +WHEN sludge_bucket = 422 THEN 'vorhanden' ---- 422 existent +END, +CASE WHEN venting = 229 THEN 'entlueftet' ---- 229 vented +WHEN venting = 230 THEN 'nicht_entlueftet' ---- 230 not_vented +WHEN venting = 5348 THEN 'unbekannt' ---- 5348 unknown +END +FROM qgep_od.cover; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'deckel' +FROM + vsa_dss_2015_2_d.deckel a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.elektrischeeinrichtung +( +t_id, bruttokosten, art, ersatzjahr) +SELECT vsa_dss_2015_2_d.tid_lookup('elektrischeeinrichtung', obj_id), gross_costs, +CASE WHEN kind = 2980 THEN 'andere' ---- 2980 other +WHEN kind = 376 THEN 'Beleuchtung' ---- 376 illumination +WHEN kind = 3255 THEN 'Fernwirkanlage' ---- 3255 remote_control_system +WHEN kind = 378 THEN 'Funk' ---- 378 radio_unit +WHEN kind = 377 THEN 'Telephon' ---- 377 phone +WHEN kind = 3038 THEN 'unbekannt' ---- 3038 unknown +END, year_of_replacement +FROM qgep_od.electric_equipment; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'elektrischeeinrichtung' +FROM + vsa_dss_2015_2_d.elektrischeeinrichtung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.elektromechanischeausruestung +( +t_id, bruttokosten, art, ersatzjahr) +SELECT vsa_dss_2015_2_d.tid_lookup('elektromechanischeausruestung', obj_id), gross_costs, +CASE WHEN kind = 2981 THEN 'andere' ---- 2981 other +WHEN kind = 380 THEN 'Leckwasserpumpe' ---- 380 leakage_water_pump +WHEN kind = 337 THEN 'Luftentfeuchter' ---- 337 air_dehumidifier +WHEN kind = 381 THEN 'Raeumeinrichtung' ---- 381 scraper_installation +WHEN kind = 3072 THEN 'unbekannt' ---- 3072 unknown +END, year_of_replacement +FROM qgep_od.electromechanical_equipment; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'elektromechanischeausruestung' +FROM + vsa_dss_2015_2_d.elektromechanischeausruestung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.bankett +( +t_id, art) +SELECT vsa_dss_2015_2_d.tid_lookup('bankett', obj_id), +CASE WHEN kind = 5319 THEN 'andere' ---- 5319 other +WHEN kind = 94 THEN 'beidseitig' ---- 94 double_sided +WHEN kind = 93 THEN 'einseitig' ---- 93 one_sided +WHEN kind = 3231 THEN 'kein' ---- 3231 none +WHEN kind = 3033 THEN 'unbekannt' ---- 3033 unknown +END +FROM qgep_od.benching; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'bankett' +FROM + vsa_dss_2015_2_d.bankett a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.anschlussobjekt +( +t_id, bezeichnung, bemerkung, fremdwasseranfall, abwassernetzelementref, eigentuemerref, betreiberref) +SELECT vsa_dss_2015_2_d.tid_lookup('anschlussobjekt', obj_id), identifier, remark, sewer_infiltration_water_production, vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_owner), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_operator) +FROM qgep_od.connection_object; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('anschlussobjekt', qgep_od.connection_object.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_connection_object.last_modification, vsa_dss_2015_2_d.tid_lookup('anschlussobjekt', qgep_od.connection_object.obj_id) +FROM qgep_od.connection_object + LEFT JOIN qgep_od.organisation as a ON od_connection_object.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_connection_object.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.gebaeude +( +t_id, hausnummer, standortname, perimeter, referenzpunkt) +SELECT vsa_dss_2015_2_d.tid_lookup('gebaeude', obj_id), house_number, location_name, ST_Force2D(perimeter_geometry), ST_Force2D(reference_point_geometry) +FROM qgep_od.building; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'gebaeude' +FROM + vsa_dss_2015_2_d.gebaeude a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.reservoir +( +t_id, standortname, lage) +SELECT vsa_dss_2015_2_d.tid_lookup('reservoir', obj_id), location_name, ST_Force2D(situation_geometry) +FROM qgep_od.reservoir; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'reservoir' +FROM + vsa_dss_2015_2_d.reservoir a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.einzelflaeche +( +t_id, funktion, neigung, befestigung, perimeter) +SELECT vsa_dss_2015_2_d.tid_lookup('einzelflaeche', obj_id), +CASE WHEN function = 2979 THEN 'andere' ---- 2979 other +WHEN function = 3466 THEN 'Bahnanlagen' ---- 3466 railway_site +WHEN function = 3461 THEN 'DachflaecheIndustrieundGewerbebetriebe' ---- 3461 roof_industrial_or_commercial_building +WHEN function = 3460 THEN 'DachflaecheWohnundBuerogebaeude' ---- 3460 roof_residential_or_office_building +WHEN function = 3464 THEN 'Erschliessungs_Sammelstrassen' ---- 3464 access_or_collecting_road +WHEN function = 3467 THEN 'Parkplaetze' ---- 3467 parking_lot +WHEN function = 3462 THEN 'UmschlagundLagerplaetze' ---- 3462 transfer_site_or_stockyard +WHEN function = 3029 THEN 'unbekannt' ---- 3029 unknown +WHEN function = 3465 THEN 'Verbindungs_Hauptverkehrs_Hochleistungsstrassen' ---- 3465 connecting_or_principal_or_major_road +WHEN function = 3463 THEN 'VorplaetzeZufahrten' ---- 3463 forecourt_and_access_road +END, inclination, +CASE WHEN pavement = 2978 THEN 'andere' ---- 2978 other +WHEN pavement = 2031 THEN 'befestigt' ---- 2031 paved +WHEN pavement = 2032 THEN 'bestockt' ---- 2032 forested +WHEN pavement = 2033 THEN 'humusiert' ---- 2033 soil_covered +WHEN pavement = 3030 THEN 'unbekannt' ---- 3030 unknown +WHEN pavement = 2034 THEN 'vegetationslos' ---- 2034 barren +END, ST_Force2D(perimeter_geometry) +FROM qgep_od.individual_surface; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'einzelflaeche' +FROM + vsa_dss_2015_2_d.einzelflaeche a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.brunnen +( +t_id, standortname, lage) +SELECT vsa_dss_2015_2_d.tid_lookup('brunnen', obj_id), location_name, ST_Force2D(situation_geometry) +FROM qgep_od.fountain; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'brunnen' +FROM + vsa_dss_2015_2_d.brunnen a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.gefahrenquelle +( +t_id, bezeichnung, bemerkung, lage, anschlussobjektref, eigentuemerref) +SELECT vsa_dss_2015_2_d.tid_lookup('gefahrenquelle', obj_id), identifier, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Anschlussobjekt', fk_connection_object), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_owner) +FROM qgep_od.hazard_source; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('gefahrenquelle', qgep_od.hazard_source.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_hazard_source.last_modification, vsa_dss_2015_2_d.tid_lookup('gefahrenquelle', qgep_od.hazard_source.obj_id) +FROM qgep_od.hazard_source + LEFT JOIN qgep_od.organisation as a ON od_hazard_source.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_hazard_source.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.unfall +( +t_id, datum, bezeichnung, ort, bemerkung, verursacher, lage, gefahrenquelleref) +SELECT vsa_dss_2015_2_d.tid_lookup('unfall', obj_id), date, identifier, place, remark, responsible, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Gefahrenquelle', fk_hazard_source) +FROM qgep_od.accident; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('unfall', qgep_od.accident.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_accident.last_modification, vsa_dss_2015_2_d.tid_lookup('unfall', qgep_od.accident.obj_id) +FROM qgep_od.accident + LEFT JOIN qgep_od.organisation as a ON od_accident.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_accident.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.stoff +( +t_id, bezeichnung, art, bemerkung, lagerung, gefahrenquelleref) +SELECT vsa_dss_2015_2_d.tid_lookup('stoff', obj_id), identifier, kind, remark, stockage, vsa_dss_2015_2_d.tid_lookup('Gefahrenquelle', fk_hazard_source) +FROM qgep_od.substance; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('stoff', qgep_od.substance.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_substance.last_modification, vsa_dss_2015_2_d.tid_lookup('stoff', qgep_od.substance.obj_id) +FROM qgep_od.substance + LEFT JOIN qgep_od.organisation as a ON od_substance.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_substance.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.einzugsgebiet +( +t_id, direkteinleitung_in_gewaesser_ist, direkteinleitung_in_gewaesser_geplant, abflussbeiwert_rw_ist, abflussbeiwert_rw_geplant, abflussbeiwert_sw_ist, abflussbeiwert_sw_geplant, entwaesserungssystem_ist, entwaesserungssystem_geplant, bezeichnung, versickerung_ist, versickerung_geplant, perimeter, einwohnerdichte_ist, einwohnerdichte_geplant, bemerkung, retention_ist, retention_geplant, abflussbegrenzung_ist, abflussbegrenzung_geplant, befestigungsgrad_rw_ist, befestigungsgrad_rw_geplant, befestigungsgrad_sw_ist, befestigungsgrad_sw_geplant, fremdwasseranfall_ist, fremdwasseranfall_geplant, flaeche, schmutzabwasseranfall_ist, schmutzabwasseranfall_geplant, abwassernetzelement_rw_istref, abwassernetzelement_rw_geplantref, abwassernetzelement_sw_geplantref, abwassernetzelement_sw_istref) +SELECT vsa_dss_2015_2_d.tid_lookup('einzugsgebiet', obj_id), +CASE WHEN direct_discharge_current = 5457 THEN 'ja' ---- 5457 yes +WHEN direct_discharge_current = 5458 THEN 'nein' ---- 5458 no +WHEN direct_discharge_current = 5463 THEN 'unbekannt' ---- 5463 unknown +END, +CASE WHEN direct_discharge_planned = 5459 THEN 'ja' ---- 5459 yes +WHEN direct_discharge_planned = 5460 THEN 'nein' ---- 5460 no +WHEN direct_discharge_planned = 5464 THEN 'unbekannt' ---- 5464 unknown +END, discharge_coefficient_rw_current, discharge_coefficient_rw_planned, discharge_coefficient_ww_current, discharge_coefficient_ww_planned, +CASE WHEN drainage_system_current = 5186 THEN 'Mischsystem' ---- 5186 mixed_system +WHEN drainage_system_current = 5188 THEN 'ModifiziertesSystem' ---- 5188 modified_system +WHEN drainage_system_current = 5185 THEN 'nicht_angeschlossen' ---- 5185 not_connected +WHEN drainage_system_current = 5537 THEN 'nicht_entwaessert' ---- 5537 not_drained +WHEN drainage_system_current = 5187 THEN 'Trennsystem' ---- 5187 separated_system +WHEN drainage_system_current = 5189 THEN 'unbekannt' ---- 5189 unknown +END, +CASE WHEN drainage_system_planned = 5191 THEN 'Mischsystem' ---- 5191 mixed_system +WHEN drainage_system_planned = 5193 THEN 'ModifiziertesSystem' ---- 5193 modified_system +WHEN drainage_system_planned = 5194 THEN 'nicht_angeschlossen' ---- 5194 not_connected +WHEN drainage_system_planned = 5536 THEN 'nicht_entwaessert' ---- 5536 not_drained +WHEN drainage_system_planned = 5192 THEN 'Trennsystem' ---- 5192 separated_system +WHEN drainage_system_planned = 5195 THEN 'unbekannt' ---- 5195 unknown +END, identifier, +CASE WHEN infiltration_current = 5452 THEN 'ja' ---- 5452 yes +WHEN infiltration_current = 5453 THEN 'nein' ---- 5453 no +WHEN infiltration_current = 5165 THEN 'unbekannt' ---- 5165 unknown +END, +CASE WHEN infiltration_planned = 5461 THEN 'ja' ---- 5461 yes +WHEN infiltration_planned = 5462 THEN 'nein' ---- 5462 no +WHEN infiltration_planned = 5170 THEN 'unbekannt' ---- 5170 unknown +END, ST_Force2D(perimeter_geometry), population_density_current, population_density_planned, remark, +CASE WHEN retention_current = 5467 THEN 'ja' ---- 5467 yes +WHEN retention_current = 5468 THEN 'nein' ---- 5468 no +WHEN retention_current = 5469 THEN 'unbekannt' ---- 5469 unknown +END, +CASE WHEN retention_planned = 5470 THEN 'ja' ---- 5470 yes +WHEN retention_planned = 5471 THEN 'nein' ---- 5471 no +WHEN retention_planned = 5472 THEN 'unbekannt' ---- 5472 unknown +END, runoff_limit_current, runoff_limit_planned, seal_factor_rw_current, seal_factor_rw_planned, seal_factor_ww_current, seal_factor_ww_planned, sewer_infiltration_water_production_current, sewer_infiltration_water_production_planned, surface_area, waste_water_production_current, waste_water_production_planned, vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement_rw_current), vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement_rw_planned), vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement_ww_planned), vsa_dss_2015_2_d.tid_lookup('Abwassernetzelement', fk_wastewater_networkelement_ww_current) +FROM qgep_od.catchment_area; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('einzugsgebiet', qgep_od.catchment_area.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_catchment_area.last_modification, vsa_dss_2015_2_d.tid_lookup('einzugsgebiet', qgep_od.catchment_area.obj_id) +FROM qgep_od.catchment_area + LEFT JOIN qgep_od.organisation as a ON od_catchment_area.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_catchment_area.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.oberflaechenabflussparameter +( +t_id, verdunstungsverlust, bezeichnung, versickerungsverlust, bemerkung, muldenverlust, benetzungsverlust, einzugsgebietref) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechenabflussparameter', obj_id), evaporation_loss, identifier, infiltration_loss, remark, surface_storage, wetting_loss, vsa_dss_2015_2_d.tid_lookup('Einzugsgebiet', fk_catchment_area) +FROM qgep_od.surface_runoff_parameters; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('oberflaechenabflussparameter', qgep_od.surface_runoff_parameters.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_surface_runoff_parameters.last_modification, vsa_dss_2015_2_d.tid_lookup('oberflaechenabflussparameter', qgep_od.surface_runoff_parameters.obj_id) +FROM qgep_od.surface_runoff_parameters + LEFT JOIN qgep_od.organisation as a ON od_surface_runoff_parameters.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_surface_runoff_parameters.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.messstelle +( +t_id, staukoerper, bezeichnung, art, zweck, bemerkung, lage, betreiberref, abwasserreinigungsanlageref, abwasserbauwerkref, gewaesserabschnittref) +SELECT vsa_dss_2015_2_d.tid_lookup('messstelle', obj_id), +CASE WHEN damming_device = 5720 THEN 'andere' ---- 5720 other +WHEN damming_device = 5721 THEN 'keiner' ---- 5721 none +WHEN damming_device = 5722 THEN 'Ueberfallwehr' ---- 5722 overflow_weir +WHEN damming_device = 5724 THEN 'unbekannt' ---- 5724 unknown +WHEN damming_device = 5723 THEN 'Venturieinschnuerung' ---- 5723 venturi_necking +END, identifier, kind, +CASE WHEN purpose = 4595 THEN 'beides' ---- 4595 both +WHEN purpose = 4593 THEN 'Kostenverteilung' ---- 4593 cost_sharing +WHEN purpose = 4594 THEN 'technischer_Zweck' ---- 4594 technical_purpose +WHEN purpose = 4592 THEN 'unbekannt' ---- 4592 unknown +END, remark, ST_Force2D(situation_geometry), vsa_dss_2015_2_d.tid_lookup('Organisation', fk_operator), vsa_dss_2015_2_d.tid_lookup('Abwasserreinigungsanlage', fk_waste_water_treatment_plant), vsa_dss_2015_2_d.tid_lookup('Abwasserbauwerk', fk_wastewater_structure), vsa_dss_2015_2_d.tid_lookup('Gewaesserabschnitt', fk_water_course_segment) +FROM qgep_od.measuring_point; + +-- additional Table Assoc: Messstelle_Referenzstelle/ no table hierarchy in qgep schema yet (check how to implement there) +-- INSERT INTO vsa_dss_2015_2_d.Messstelle_Referenzstelleassoc +-- ( +-- t_id, Referenzstelleref, Messstelle_Referenzstelleassocref) +-- SELECT vsa_dss_2015_2_d.tid_lookup('Messstelle', obj_id), vsa_dss_2015_2_d.tid_lookup('Messstelle', fk_reference_station),vsa_dss_2015_2_d.tid_lookup('Messstelle', obj_id) +-- FROM qgep_od.messstelle; + + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('messstelle', qgep_od.measuring_point.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_measuring_point.last_modification, vsa_dss_2015_2_d.tid_lookup('messstelle', qgep_od.measuring_point.obj_id) +FROM qgep_od.measuring_point + LEFT JOIN qgep_od.organisation as a ON od_measuring_point.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_measuring_point.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.messgeraet +( +t_id, fabrikat, bezeichnung, art, bemerkung, seriennummer, messstelleref) +SELECT vsa_dss_2015_2_d.tid_lookup('messgeraet', obj_id), brand, identifier, +CASE WHEN kind = 5702 THEN 'andere' ---- 5702 other +WHEN kind = 5703 THEN 'Drucksonde' ---- 5703 static_sounding_stick +WHEN kind = 5704 THEN 'Lufteinperlung' ---- 5704 bubbler_system +WHEN kind = 5705 THEN 'MID_teilgefuellt' ---- 5705 EMF_partly_filled +WHEN kind = 5706 THEN 'MID_vollgefuellt' ---- 5706 EMF_filled +WHEN kind = 5707 THEN 'Radar' ---- 5707 radar +WHEN kind = 5708 THEN 'Schwimmer' ---- 5708 float +WHEN kind = 6322 THEN 'Ultraschall' ---- 6322 ultrasound +WHEN kind = 5709 THEN 'unbekannt' ---- 5709 unknown +END, remark, serial_number, vsa_dss_2015_2_d.tid_lookup('Messstelle', fk_measuring_point) +FROM qgep_od.measuring_device; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('messgeraet', qgep_od.measuring_device.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_measuring_device.last_modification, vsa_dss_2015_2_d.tid_lookup('messgeraet', qgep_od.measuring_device.obj_id) +FROM qgep_od.measuring_device + LEFT JOIN qgep_od.organisation as a ON od_measuring_device.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_measuring_device.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.messreihe +( +t_id, dimension, bezeichnung, art, bemerkung, messstelleref) +SELECT vsa_dss_2015_2_d.tid_lookup('messreihe', obj_id), dimension, identifier, +CASE WHEN kind = 3217 THEN 'andere' ---- 3217 other +WHEN kind = 2646 THEN 'kontinuierlich' ---- 2646 continuous +WHEN kind = 2647 THEN 'Regenwetter' ---- 2647 rain_weather +WHEN kind = 3053 THEN 'unbekannt' ---- 3053 unknown +END, remark, vsa_dss_2015_2_d.tid_lookup('Messstelle', fk_measuring_point) +FROM qgep_od.measurement_series; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('messreihe', qgep_od.measurement_series.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_measurement_series.last_modification, vsa_dss_2015_2_d.tid_lookup('messreihe', qgep_od.measurement_series.obj_id) +FROM qgep_od.measurement_series + LEFT JOIN qgep_od.organisation as a ON od_measurement_series.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_measurement_series.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.messresultat +( +t_id, bezeichnung, messart, messdauer, bemerkung, zeit, wert, messgeraetref, messreiheref) +SELECT vsa_dss_2015_2_d.tid_lookup('messresultat', obj_id), identifier, +CASE WHEN measurement_type = 5732 THEN 'andere' ---- 5732 other +WHEN measurement_type = 5733 THEN 'Durchfluss' ---- 5733 flow +WHEN measurement_type = 5734 THEN 'Niveau' ---- 5734 level +WHEN measurement_type = 5735 THEN 'unbekannt' ---- 5735 unknown +END, measuring_duration, remark, time, value, vsa_dss_2015_2_d.tid_lookup('Messgeraet', fk_measuring_device), vsa_dss_2015_2_d.tid_lookup('Messreihe', fk_measurement_series) +FROM qgep_od.measurement_result; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('messresultat', qgep_od.measurement_result.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_measurement_result.last_modification, vsa_dss_2015_2_d.tid_lookup('messresultat', qgep_od.measurement_result.obj_id) +FROM qgep_od.measurement_result + LEFT JOIN qgep_od.organisation as a ON od_measurement_result.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_measurement_result.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.ueberlauf +( +t_id, antrieb, verstellbarkeit, fabrikat, steuerung, einleitstelle, funktion, bruttokosten, bezeichnung, qan_dim, bemerkung, signaluebermittlung, subventionen, abwasserknotenref, ueberlaufnachref, ueberlaufcharakteristikref, steuerungszentraleref) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlauf', obj_id), +CASE WHEN actuation = 3667 THEN 'andere' ---- 3667 other +WHEN actuation = 301 THEN 'Benzinmotor' ---- 301 gaz_engine +WHEN actuation = 302 THEN 'Dieselmotor' ---- 302 diesel_engine +WHEN actuation = 303 THEN 'Elektromotor' ---- 303 electric_engine +WHEN actuation = 433 THEN 'hydraulisch' ---- 433 hydraulic +WHEN actuation = 300 THEN 'keiner' ---- 300 none +WHEN actuation = 305 THEN 'manuell' ---- 305 manual +WHEN actuation = 304 THEN 'pneumatisch' ---- 304 pneumatic +WHEN actuation = 3005 THEN 'unbekannt' ---- 3005 unknown +END, +CASE WHEN adjustability = 355 THEN 'fest' ---- 355 fixed +WHEN adjustability = 3021 THEN 'unbekannt' ---- 3021 unknown +WHEN adjustability = 356 THEN 'verstellbar' ---- 356 adjustable +END, brand, +CASE WHEN control = 308 THEN 'geregelt' ---- 308 closed_loop_control +WHEN control = 307 THEN 'gesteuert' ---- 307 open_loop_control +WHEN control = 306 THEN 'keine' ---- 306 none +WHEN control = 3028 THEN 'unbekannt' ---- 3028 unknown +END, discharge_point, +CASE WHEN function = 3228 THEN 'andere' ---- 3228 other +WHEN function = 3384 THEN 'intern' ---- 3384 internal +WHEN function = 217 THEN 'Notentlastung' ---- 217 emergency_overflow +WHEN function = 5544 THEN 'Regenueberlauf' ---- 5544 stormwater_overflow +WHEN function = 5546 THEN 'Trennueberlauf' ---- 5546 internal_overflow +WHEN function = 3010 THEN 'unbekannt' ---- 3010 unknown +END, gross_costs, identifier, qon_dim, remark, +CASE WHEN signal_transmission = 2694 THEN 'empfangen' ---- 2694 receiving +WHEN signal_transmission = 2693 THEN 'senden' ---- 2693 sending +WHEN signal_transmission = 2695 THEN 'senden_empfangen' ---- 2695 sending_receiving +WHEN signal_transmission = 3056 THEN 'unbekannt' ---- 3056 unknown +END, subsidies, vsa_dss_2015_2_d.tid_lookup('Abwasserknoten', fk_wastewater_node), vsa_dss_2015_2_d.tid_lookup('Abwasserknoten', fk_overflow_to), vsa_dss_2015_2_d.tid_lookup('Ueberlaufcharakteristik', fk_overflow_characteristic), vsa_dss_2015_2_d.tid_lookup('Steuerungszentrale', fk_control_center) +FROM qgep_od.overflow; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('ueberlauf', qgep_od.overflow.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_overflow.last_modification, vsa_dss_2015_2_d.tid_lookup('ueberlauf', qgep_od.overflow.obj_id) +FROM qgep_od.overflow + LEFT JOIN qgep_od.organisation as a ON od_overflow.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_overflow.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.absperr_drosselorgan +( +t_id, antrieb, verstellbarkeit, steuerung, querschnitt, wirksamer_qs, bruttokosten, bezeichnung, art, fabrikat, bemerkung, signaluebermittlung, subventionen, drosselorgan_oeffnung_ist, drosselorgan_oeffnung_ist_optimiert, abwasserknotenref, steuerungszentraleref, ueberlaufref) +SELECT vsa_dss_2015_2_d.tid_lookup('absperr_drosselorgan', obj_id), +CASE WHEN actuation = 3213 THEN 'andere' ---- 3213 other +WHEN actuation = 3154 THEN 'Benzinmotor' ---- 3154 gaz_engine +WHEN actuation = 3155 THEN 'Dieselmotor' ---- 3155 diesel_engine +WHEN actuation = 3156 THEN 'Elektromotor' ---- 3156 electric_engine +WHEN actuation = 3152 THEN 'hydraulisch' ---- 3152 hydraulic +WHEN actuation = 3153 THEN 'keiner' ---- 3153 none +WHEN actuation = 3157 THEN 'manuell' ---- 3157 manual +WHEN actuation = 3158 THEN 'pneumatisch' ---- 3158 pneumatic +WHEN actuation = 3151 THEN 'unbekannt' ---- 3151 unknown +END, +CASE WHEN adjustability = 3159 THEN 'fest' ---- 3159 fixed +WHEN adjustability = 3161 THEN 'unbekannt' ---- 3161 unknown +WHEN adjustability = 3160 THEN 'verstellbar' ---- 3160 adjustable +END, +CASE WHEN control = 3162 THEN 'geregelt' ---- 3162 closed_loop_control +WHEN control = 3163 THEN 'gesteuert' ---- 3163 open_loop_control +WHEN control = 3165 THEN 'keine' ---- 3165 none +WHEN control = 3164 THEN 'unbekannt' ---- 3164 unknown +END, cross_section, effective_cross_section, gross_costs, identifier, +CASE WHEN kind = 2973 THEN 'andere' ---- 2973 other +WHEN kind = 2746 THEN 'Blende' ---- 2746 orifice +WHEN kind = 2691 THEN 'Dammbalken' ---- 2691 stop_log +WHEN kind = 252 THEN 'Drosselklappe' ---- 252 throttle_flap +WHEN kind = 135 THEN 'Drosselschieber' ---- 135 throttle_valve +WHEN kind = 6490 THEN 'Drosselstrecke' ---- 6490 throttle_section +WHEN kind = 6491 THEN 'Leapingwehr' ---- 6491 leapingweir +WHEN kind = 6492 THEN 'Pumpe' ---- 6492 pomp +WHEN kind = 2690 THEN 'Rueckstauklappe' ---- 2690 backflow_flap +WHEN kind = 2688 THEN 'Schieber' ---- 2688 valve +WHEN kind = 134 THEN 'Schlauchdrossel' ---- 134 tube_throttle +WHEN kind = 2689 THEN 'Schuetze' ---- 2689 sliding_valve +WHEN kind = 5755 THEN 'Stauschild' ---- 5755 gate_shield +WHEN kind = 3046 THEN 'unbekannt' ---- 3046 unknown +WHEN kind = 133 THEN 'Wirbeldrossel' ---- 133 whirl_throttle +END, manufacturer, remark, +CASE WHEN signal_transmission = 3171 THEN 'empfangen' ---- 3171 receiving +WHEN signal_transmission = 3172 THEN 'senden' ---- 3172 sending +WHEN signal_transmission = 3169 THEN 'senden_empfangen' ---- 3169 sending_receiving +WHEN signal_transmission = 3170 THEN 'unbekannt' ---- 3170 unknown +END, subsidies, throttle_unit_opening_current, throttle_unit_opening_current_optimized, vsa_dss_2015_2_d.tid_lookup('Abwasserknoten', fk_wastewater_node), vsa_dss_2015_2_d.tid_lookup('Steuerungszentrale', fk_control_center), vsa_dss_2015_2_d.tid_lookup('Ueberlauf', fk_overflow) +FROM qgep_od.throttle_shut_off_unit; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('absperr_drosselorgan', qgep_od.throttle_shut_off_unit.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_throttle_shut_off_unit.last_modification, vsa_dss_2015_2_d.tid_lookup('absperr_drosselorgan', qgep_od.throttle_shut_off_unit.obj_id) +FROM qgep_od.throttle_shut_off_unit + LEFT JOIN qgep_od.organisation as a ON od_throttle_shut_off_unit.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_throttle_shut_off_unit.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.streichwehr +( +t_id, hydrueberfalllaenge, kotemax, kotemin, ueberfallkante, wehr_art) +SELECT vsa_dss_2015_2_d.tid_lookup('streichwehr', obj_id), hydraulic_overflow_length, level_max, level_min, +CASE WHEN weir_edge = 2995 THEN 'andere' ---- 2995 other +WHEN weir_edge = 351 THEN 'rechteckig' ---- 351 rectangular +WHEN weir_edge = 350 THEN 'rund' ---- 350 round +WHEN weir_edge = 349 THEN 'scharfkantig' ---- 349 sharp_edged +WHEN weir_edge = 3014 THEN 'unbekannt' ---- 3014 unknown +END, +CASE WHEN weir_kind = 5772 THEN 'hochgezogen' ---- 5772 raised +WHEN weir_kind = 5771 THEN 'niedrig' ---- 5771 low +END +FROM qgep_od.prank_weir; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'streichwehr' +FROM + vsa_dss_2015_2_d.streichwehr a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.foerderaggregat +( +t_id, bauart, arbeitspunkt, aufstellungantrieb, aufstellungfoerderaggregat, foerderstrommax_einzel, foerderstrommin_einzel, kotestart, kotestop, nutzungsart_ist) +SELECT vsa_dss_2015_2_d.tid_lookup('foerderaggregat', obj_id), +CASE WHEN contruction_type = 2983 THEN 'andere' ---- 2983 other +WHEN contruction_type = 2662 THEN 'Druckluftanlage' ---- 2662 compressed_air_system +WHEN contruction_type = 314 THEN 'Kolbenpumpe' ---- 314 piston_pump +WHEN contruction_type = 309 THEN 'Kreiselpumpe' ---- 309 centrifugal_pump +WHEN contruction_type = 310 THEN 'Schneckenpumpe' ---- 310 screw_pump +WHEN contruction_type = 3082 THEN 'unbekannt' ---- 3082 unknown +WHEN contruction_type = 2661 THEN 'Vakuumanlage' ---- 2661 vacuum_system +END, operating_point, +CASE WHEN placement_of_actuation = 318 THEN 'nass' ---- 318 wet +WHEN placement_of_actuation = 311 THEN 'trocken' ---- 311 dry +WHEN placement_of_actuation = 3070 THEN 'unbekannt' ---- 3070 unknown +END, +CASE WHEN placement_of_pump = 362 THEN 'horizontal' ---- 362 horizontal +WHEN placement_of_pump = 3071 THEN 'unbekannt' ---- 3071 unknown +WHEN placement_of_pump = 363 THEN 'vertikal' ---- 363 vertical +END, pump_flow_max_single, pump_flow_min_single, start_level, stop_level, +CASE WHEN usage_current = 6325 THEN 'andere' ---- 6325 other +WHEN usage_current = 6202 THEN 'Bachwasser' ---- 6202 creek_water +WHEN usage_current = 6203 THEN 'entlastetes_Mischabwasser' ---- 6203 discharged_combined_wastewater +WHEN usage_current = 6204 THEN 'Industrieabwasser' ---- 6204 industrial_wastewater +WHEN usage_current = 6201 THEN 'Mischabwasser' ---- 6201 combined_wastewater +WHEN usage_current = 6205 THEN 'Regenabwasser' ---- 6205 rain_wastewater +WHEN usage_current = 6200 THEN 'Reinabwasser' ---- 6200 clean_wastewater +WHEN usage_current = 6206 THEN 'Schmutzabwasser' ---- 6206 wastewater +WHEN usage_current = 6326 THEN 'unbekannt' ---- 6326 unknown +END +FROM qgep_od.pump; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'foerderaggregat' +FROM + vsa_dss_2015_2_d.foerderaggregat a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.leapingwehr +( +t_id, laenge, oeffnungsform, breite) +SELECT vsa_dss_2015_2_d.tid_lookup('leapingwehr', obj_id), length, +CASE WHEN opening_shape = 3581 THEN 'andere' ---- 3581 other +WHEN opening_shape = 3582 THEN 'Kreis' ---- 3582 circle +WHEN opening_shape = 3585 THEN 'Parabel' ---- 3585 parable +WHEN opening_shape = 3583 THEN 'Rechteck' ---- 3583 rectangular +WHEN opening_shape = 3584 THEN 'unbekannt' ---- 3584 unknown +END, width +FROM qgep_od.leapingweir; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'leapingwehr' +FROM + vsa_dss_2015_2_d.leapingwehr a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.hydr_kennwerte +( +t_id, aggregatezahl, foerderhoehe_geodaetisch, bezeichnung, springt_an, hauptwehrart, mehrbelastung, ueberlaufdauer, ueberlauffracht, ueberlaufhaeufigkeit, ueberlaufmenge, pumpenregime, foerderstrommax, foerderstrommin, foerderaggregat_nutzungsart_ist, qab, qan, bemerkung, status, abwasserknotenref, ueberlaufcharakteristikref) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_kennwerte', obj_id), aggregate_number, delivery_height_geodaetic, identifier, +CASE WHEN is_overflowing = 5774 THEN 'ja' ---- 5774 yes +WHEN is_overflowing = 5775 THEN 'nein' ---- 5775 no +WHEN is_overflowing = 5778 THEN 'unbekannt' ---- 5778 unknown +END, +CASE WHEN main_weir_kind = 6422 THEN 'Leapingwehr' ---- 6422 leapingweir +WHEN main_weir_kind = 6420 THEN 'Streichwehr_hochgezogen' ---- 6420 spillway_raised +WHEN main_weir_kind = 6421 THEN 'Streichwehr_niedrig' ---- 6421 spillway_low +END, overcharge, overflow_duration, overflow_freight, overflow_frequency, overflow_volume, +CASE WHEN pump_characteristics = 6374 THEN 'alternierend' ---- 6374 alternating +WHEN pump_characteristics = 6375 THEN 'andere' ---- 6375 other +WHEN pump_characteristics = 6376 THEN 'einzeln' ---- 6376 single +WHEN pump_characteristics = 6377 THEN 'parallel' ---- 6377 parallel +WHEN pump_characteristics = 6378 THEN 'unbekannt' ---- 6378 unknown +END, pump_flow_max, pump_flow_min, +CASE WHEN pump_usage_current = 6361 THEN 'andere' ---- 6361 other +WHEN pump_usage_current = 6362 THEN 'Bachwasser' ---- 6362 creek_water +WHEN pump_usage_current = 6363 THEN 'entlastetes_Mischabwasser' ---- 6363 discharged_combined_wastewater +WHEN pump_usage_current = 6364 THEN 'Industrieabwasser' ---- 6364 industrial_wastewater +WHEN pump_usage_current = 6365 THEN 'Mischabwasser' ---- 6365 combined_wastewater +WHEN pump_usage_current = 6366 THEN 'Regenabwasser' ---- 6366 rain_wastewater +WHEN pump_usage_current = 6367 THEN 'Reinabwasser' ---- 6367 clean_wastewater +WHEN pump_usage_current = 6368 THEN 'Schmutzabwasser' ---- 6368 wastewater +WHEN pump_usage_current = 6369 THEN 'unbekannt' ---- 6369 unknown +END, q_discharge, qon, remark, +CASE WHEN status = 6371 THEN 'geplant' ---- 6371 planned +WHEN status = 6372 THEN 'Ist' ---- 6372 current +WHEN status = 6373 THEN 'Ist_optimiert' ---- 6373 current_optimized +END, vsa_dss_2015_2_d.tid_lookup('Abwasserknoten', fk_wastewater_node), vsa_dss_2015_2_d.tid_lookup('Ueberlaufcharakteristik', fk_overflow_characteristic) +FROM qgep_od.hydraulic_characteristic_data; + +INSERT INTO vsa_dss_2015_2_d.metaattribute +( +t_id, t_seq, datenherr, datenlieferant, letzte_aenderung, sia405_baseclass_metaattribute) +SELECT vsa_dss_2015_2_d.tid_lookup('hydr_kennwerte', qgep_od.hydraulic_characteristic_data.obj_id), '0', a.identifier as dataowner, b.identifier as provider, od_hydraulic_characteristic_data.last_modification, vsa_dss_2015_2_d.tid_lookup('hydr_kennwerte', qgep_od.hydraulic_characteristic_data.obj_id) +FROM qgep_od.hydraulic_characteristic_data + LEFT JOIN qgep_od.organisation as a ON od_hydraulic_characteristic_data.fk_dataowner = a.obj_id + LEFT JOIN qgep_od.organisation as b ON od_hydraulic_characteristic_data.fk_provider = b.obj_id; + +INSERT INTO vsa_dss_2015_2_d.rueckstausicherung +( +t_id, bruttokosten, art, ersatzjahr, absperr_drosselorganref, foerderaggregatref) +SELECT vsa_dss_2015_2_d.tid_lookup('rueckstausicherung', obj_id), gross_costs, +CASE WHEN kind = 5760 THEN 'andere' ---- 5760 other +WHEN kind = 5759 THEN 'Pumpe' ---- 5759 pump +WHEN kind = 5757 THEN 'Rueckstauklappe' ---- 5757 backflow_flap +WHEN kind = 5758 THEN 'Stauschild' ---- 5758 gate_shield +END, year_of_replacement, vsa_dss_2015_2_d.tid_lookup('Absperr_Drosselorgan', fk_throttle_shut_off_unit), vsa_dss_2015_2_d.tid_lookup('FoerderAggregat', fk_pump) +FROM qgep_od.backflow_prevention; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'rueckstausicherung' +FROM + vsa_dss_2015_2_d.rueckstausicherung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.feststoffrueckhalt +( +t_id, dimensionierungswert, bruttokosten, anspringkote, art, ersatzjahr) +SELECT vsa_dss_2015_2_d.tid_lookup('feststoffrueckhalt', obj_id), dimensioning_value, gross_costs, overflow_level, +CASE WHEN type = 5664 THEN 'andere' ---- 5664 other +WHEN type = 5665 THEN 'Feinrechen' ---- 5665 fine_screen +WHEN type = 5666 THEN 'Grobrechen' ---- 5666 coarse_screen +WHEN type = 5667 THEN 'Sieb' ---- 5667 sieve +WHEN type = 5668 THEN 'Tauchwand' ---- 5668 scumboard +WHEN type = 5669 THEN 'unbekannt' ---- 5669 unknown +END, year_of_replacement +FROM qgep_od.solids_retention; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'feststoffrueckhalt' +FROM + vsa_dss_2015_2_d.feststoffrueckhalt a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.beckenreinigung +( +t_id, bruttokosten, art, ersatzjahr) +SELECT vsa_dss_2015_2_d.tid_lookup('beckenreinigung', obj_id), gross_costs, +CASE WHEN type = 5621 THEN 'Air_Jet' ---- 5621 airjet +WHEN type = 5620 THEN 'andere' ---- 5620 other +WHEN type = 5622 THEN 'keine' ---- 5622 none +WHEN type = 5623 THEN 'Schwallspuelung' ---- 5623 surge_flushing +WHEN type = 5624 THEN 'Spuelkippe' ---- 5624 tipping_bucket +END, year_of_replacement +FROM qgep_od.tank_cleaning; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'beckenreinigung' +FROM + vsa_dss_2015_2_d.beckenreinigung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.beckenentleerung +( +t_id, leistung, bruttokosten, art, ersatzjahr, absperr_drosselorganref, ueberlaufref) +SELECT vsa_dss_2015_2_d.tid_lookup('beckenentleerung', obj_id), flow, gross_costs, +CASE WHEN type = 5626 THEN 'andere' ---- 5626 other +WHEN type = 5627 THEN 'keine' ---- 5627 none +WHEN type = 5628 THEN 'Pumpe' ---- 5628 pump +WHEN type = 5629 THEN 'Schieber' ---- 5629 valve +END, year_of_replacement, vsa_dss_2015_2_d.tid_lookup('Absperr_Drosselorgan', fk_throttle_shut_off_unit), vsa_dss_2015_2_d.tid_lookup('FoerderAggregat', fk_overflow) +FROM qgep_od.tank_emptying; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'beckenentleerung' +FROM + vsa_dss_2015_2_d.beckenentleerung a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.ezg_parameter_allg +( +t_id, trockenwetteranfall, fliessweglaenge, fliessweggefaelle, einwohnergleichwert, flaeche) +SELECT vsa_dss_2015_2_d.tid_lookup('ezg_parameter_allg', obj_id), dry_wheather_flow, flow_path_length, flow_path_slope, population_equivalent, surface_ca +FROM qgep_od.param_ca_general; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'ezg_parameter_allg' +FROM + vsa_dss_2015_2_d.ezg_parameter_allg a +WHERE + baseclass.t_id = a.t_id; + +INSERT INTO vsa_dss_2015_2_d.ezg_parameter_mouse1 +( +t_id, trockenwetteranfall, fliessweglaenge, fliessweggefaelle, einwohnergleichwert, flaeche, nutzungsart) +SELECT vsa_dss_2015_2_d.tid_lookup('ezg_parameter_mouse1', obj_id), dry_wheather_flow, flow_path_length, flow_path_slope, population_equivalent, surface_ca_mouse, usage +FROM qgep_od.param_ca_mouse1; + +UPDATE vsa_dss_2015_2_d.baseclass SET t_type = 'ezg_parameter_mouse1' +FROM + vsa_dss_2015_2_d.ezg_parameter_mouse1 a +WHERE + baseclass.t_id = a.t_id; + +--- import_basket aktualisieren +SELECT vsa_dss_2015_2_d.basket_update(); + +COMMIT; diff --git a/docs/stefans_scripts/export/vsa_dss_2015/99_export_VSA_DSS_2015_2.bat b/docs/stefans_scripts/export/vsa_dss_2015/99_export_VSA_DSS_2015_2.bat new file mode 100644 index 00000000..3c0697f7 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/99_export_VSA_DSS_2015_2.bat @@ -0,0 +1 @@ +java -jar ../ili2pg-3.12.2 --trace --export --log export_VSA_DSS_2015_2_d.log --models DSS_2015_LV95 --dbhost localhost --dbport 5432 --dbdatabase qgep --dbschema vsa_dss_2015_2_d --dbusr postgres --dbpwd yourpassword exportfilename.xtf diff --git a/docs/stefans_scripts/export/vsa_dss_2015/e1_createexportschema_vsa_dss_2015_2_d.bat b/docs/stefans_scripts/export/vsa_dss_2015/e1_createexportschema_vsa_dss_2015_2_d.bat new file mode 100644 index 00000000..eab4d447 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/e1_createexportschema_vsa_dss_2015_2_d.bat @@ -0,0 +1,3 @@ +rem set variable to ili2pg*.jar, dbdatabase, dbpwd, ilipath etc. + +java -jar ../ili2pg-3.12.2.jar --createEnumTxtCol --schemaimport --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --dbdatabase qgep --dbschema vsa_dss_2015_2_d --dbusr postgres --dbpwd yourpassword --log createschema_VSA_DSS_2015_2_d.log VSA_DSS_2015_2_d.ili diff --git a/docs/stefans_scripts/export/vsa_dss_2015/e2_exportschema_anpassungen_vsa_dss_2015_2_d.bat b/docs/stefans_scripts/export/vsa_dss_2015/e2_exportschema_anpassungen_vsa_dss_2015_2_d.bat new file mode 100644 index 00000000..6082bbe2 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/e2_exportschema_anpassungen_vsa_dss_2015_2_d.bat @@ -0,0 +1,28 @@ +rem choose your database name +set db=qgep_prod +rem adapt port of your database +set port=5434 +rem adapt postgres path to your system +set PATH=%PATH%;C:\Program Files\PostgreSQL\9.6\bin + +rem db erzeugen +rem createdb -U postgres -p %port% %db% +psql -U postgres -h localhost -p %port% -d %db% -f 01_vsa_dss_2015_2_d_tid_generate.sql> 01_tid_generate.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 02_vsa_dss_2015_2_d_tid_lookup.sql> 02_tid_lookup.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 046_vsa_dss_2015_2_d_t_key_object_insert_metadata.sql> 046_t_key_object_insert_metadata.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 050_vsa_dss_2015_2.vw_sia405_baseclass_metattribute.sql> 050_vw_sia405_baseclass_metattribute.log 2>&1 +PAUSE + +-- rem neu 12.7.2019 +psql -U postgres -h localhost -p %port% -d %db% -f vsa_dss_2015_2_d.vw_organisation.sql> vsa_dss_2015_2_d.vw_organisation.log 2>&1 +PAUSE + +rem neu 15.8.2019 +psql -U postgres -h localhost -p %port% -d %db% -f 022_vsa_dss_2015_2_d_basket_update.sql > 022_vsa_dss_2015_2_d_basket_update.log 2>&1 +PAUSE diff --git a/docs/stefans_scripts/export/vsa_dss_2015/e3_datenexport_vsa_dss_2015_2_391_nosmart.bat b/docs/stefans_scripts/export/vsa_dss_2015/e3_datenexport_vsa_dss_2015_2_391_nosmart.bat new file mode 100644 index 00000000..7afef256 --- /dev/null +++ b/docs/stefans_scripts/export/vsa_dss_2015/e3_datenexport_vsa_dss_2015_2_391_nosmart.bat @@ -0,0 +1,11 @@ +rem bat and sql in the same directory +set PATH=%PATH%;C:\Program Files\PostgreSQL\9.3\bin +rem base: psql -h %localhost% -p 5432 -U %postgres% -d %qgep% -f 'xy.sql' +rem works for database "qgepe" on localhost + + +rem set variable to ili2pg*.jar, dbdatabase, dbpwd, ilipath, xtf path etc. + +java -jar ili2pg.jar --export --trace --log vsa_dss_2015_2_d_391_exp.log --models DSS_2015 --noSmartMapping --dbhost localhost --dbport 5432 --dbdatabase postgres --dbschema vsa_dss_2015_2_d_391 --dbusr postgres --dbpwd yourpassword vsa_dss_2015_2_d_391_exp.xtf +pause +rem takes xx sec diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/01_abwa_2015neu_3122_tid_generate.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/01_abwa_2015neu_3122_tid_generate.sql new file mode 100644 index 00000000..422ec012 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/01_abwa_2015neu_3122_tid_generate.sql @@ -0,0 +1,53 @@ +-- this file generates a new SQL function to create TIDs for all the tables of the import/export schema with ili2pg. +-- you need to set the current maxvalue of the TID into the schema.table.field abwa_2015neu_3122.t_key_object.t_lastuniqueid +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_generate.sql +-- schema für export heisst abwa_2015neu_3122 + + +-- function for generating TIDs +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.tid_generate(table_name text, obj_id_table text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + nexttid integer; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('abwa_2015neu_3122.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + -- 23.12.2015 SELECT t_lastuniqueid FROM abwa_2015neu_3122.t_key_object AS nexttid; + SELECT t_lastuniqueid INTO nexttid FROM abwa_2015neu_3122.t_key_object; + newtid = (nexttid + 1); + + -- 12.1.2016 + RAISE NOTICE 'newtid is %', newtid; -- Print newtid + RAISE NOTICE 'nexttid is %', nexttid; -- Print nexttid + + -- adapt t_lastuniqueid in t_key_object + UPDATE abwa_2015neu_3122.t_key_object + SET t_lastuniqueid = newtid + , t_user = current_user + , t_createdate = current_timestamp + WHERE t_lastuniqueid = nexttid; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table % not found', table_name; + ELSE + RAISE NOTICE 't_key_object updated'; + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN newtid; + + + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_identifier_lookup.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_identifier_lookup.sql new file mode 100644 index 00000000..973fbf02 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_identifier_lookup.sql @@ -0,0 +1,51 @@ +-- this file looks up the obj_id for identifiers of table organisation in schema with ili2pg. Can be used to replace datenherr, datenlieferant from INTERLIS that are text of identifier to be replace by obj_id of that organisation e.g datenherr = 'VSA'. Needs entries of organisations of datenherr / datenlieferant in table organisation to get a valid lookup of identifer -> obj_id. + +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- schema für export heisst abwa_2015neu_3122. +-- last update 3.3.2019 Stefan Burckhardt +-- -- select abwa_2015neu_3122.obj_id_identifer_organisation_lookup('unbekannt'); + + +-- function for looking up obj_id +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.obj_id_identifer_organisation_lookup(identifier_ref text) + -- RETURNS text AS + RETURNS text AS +$BODY$ +DECLARE + objid_ref text; + +BEGIN + + -- 3.2.2017 check whether obj_id_ref NOT IS NULL + IF identifier_ref IS NULL THEN + objid_ref = NULL; + RAISE NOTICE '[obj_id_identifer_organisation_lookup]: identifier is NULL . objid_ref set NULL also'; -- Print identifier + -- to do option check ob identifier eine obj_id ist + ELSE + -- RAISE NOTICE '[obj_id_identifer_organisation_lookup]: identifier % ->',identifier_ref; -- Print identifier + -- get objid_ref for t_id + -- needs vw_organisation as + -- SELECT obj_id, bezeichnung, bemerkung, uid, Letzte_Aenderung, Datenherr, datenlieferant FROM abwa_2015neu_3122.organisation LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.organisation.t_id = vw_sia405_baseclass_metaattribute.t_id ; + SELECT obj_id INTO objid_ref FROM abwa_2015neu_3122.vw_organisation WHERE bezeichnung = identifier_ref; + + + IF NOT FOUND THEN + RAISE NOTICE '[obj_id_identifer_organisation_lookup]: Corresponding to identifier %',identifier_ref; -- Print identifier + RAISE NOTICE 'obj_id_ref for organisation not found. Keeping identifier as is!'; + -- RAISE EXCEPTION 'Missing obj_id in table organisation'; + objid_ref = identifier_ref; + ELSE + -- 3.2.2017 comment out to speed up + RAISE NOTICE '[obj_id_identifer_organisation_lookup]: 2Corresponding to identifier %',identifier_ref; -- Print identifier + RAISE NOTICE 'obj_id is %', objid_ref; + + END IF; + END IF; + + RETURN objid_ref; + +END; +$BODY$ + -- 3.2.2017 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_objid_lookup.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_objid_lookup.sql new file mode 100644 index 00000000..7aed8302 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_objid_lookup.sql @@ -0,0 +1,44 @@ +-- this file looks up the obj_id for foreignkeys (OID) for the tables of the import/export schema with ili2pg. +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_lookup.sql +-- schema für export heisst abwa_2015neu_3122. +-- last update 3.2.2017 / 9.10.2018 Stefan Burckhardt + +-- function for looking up obj_id +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.objid_lookup(table_name text, tid_ref integer) + -- RETURNS text AS + RETURNS text AS +$BODY$ +DECLARE + objid_ref text; + +BEGIN + -- 3.2.2017 check whether obj_id_ref NOT IS NULL + IF tid_ref IS NULL THEN + objid_ref = NULL; + RAISE NOTICE '[objid_lookup]: tid is NULL . objid_ref set NULL also'; -- Print newtid + ELSE + -- get objid_ref for t_id + -- SELECT t_id INTO tid_ref FROM abwa_2015neu_3122.baseclass WHERE t_ili_tid = 'ch13p7mzOG000002'; + SELECT obj_id INTO objid_ref FROM abwa_2015neu_3122.sia405_baseclass WHERE t_id = tid_ref; + + IF NOT FOUND THEN + RAISE NOTICE '[objid_lookup]: Corresponding to t_id % ->',tid_ref; -- Print newtid + RAISE NOTICE 'tid_ref for table % not found', table_name; + RAISE EXCEPTION 'Missing obj_id in table sia405_baseclass'; + + ELSE + -- 3.2.2017 comment out to speed up + RAISE NOTICE '[tid_lookup]: Corresponding to t_id % ->',tid_ref; -- Print newtid + RAISE NOTICE 'obj_id is %', objid_ref; + + END IF; + END IF; + + RETURN objid_ref; + +END; +$BODY$ + -- 3.2.2017 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_tid_lookup.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_tid_lookup.sql new file mode 100644 index 00000000..d3641dc0 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/02_abwa_2015neu_3122_tid_lookup.sql @@ -0,0 +1,51 @@ +-- this file looks up the t_id for foreignkeys (OID) for the tables of the import/export schema with ili2pg. +-- questions regarding this function should be directed to Stefan Burckhardt stefan.burckhardt@sjib.ch +-- basis ist tid_lookup.sql +-- schema für export heisst abwa_2015neu_3122. +-- last update 18.11.2016 Stefan Burckhardt + +-- function for looking up t_id +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.tid_lookup(table_name text, obj_id_ref text) + -- RETURNS text AS + RETURNS integer AS +$BODY$ +DECLARE + tid_ref integer; + -- newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + -- 9.3.2016 check whether obj_id_ref NOT IS NULL + IF obj_id_ref IS NULL THEN + tid_ref = NULL; + RAISE NOTICE '[tid_lookup]: obj_id is NULL . tid_ref set NULL also'; -- Print newtid + ELSE + -- get tid_ref for foreignkey + -- SELECT t_id INTO tid_ref FROM abwa_2015neu_3122.baseclass WHERE t_ili_tid = 'ch13p7mzOG000002'; + SELECT t_id INTO tid_ref FROM abwa_2015neu_3122.baseclass WHERE t_ili_tid = obj_id_ref; + + IF NOT FOUND THEN + -- 13.2.2016 / 9.3.2016 improved error message + -- RAISE EXCEPTION 'tid_ref for table % not found', table_name; + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref for table % not found', table_name; + RAISE EXCEPTION 'Missing t_id in table baseclass'; + + ELSE + -- 12.1.2016 + -- 13.2.2016 comment out to speed up + -- 9.3.2016 Hineis ergänzt mit OBJ_ID + RAISE NOTICE '[tid_lookup]: Corresponding to obj_id % ->',obj_id_ref; -- Print newtid + RAISE NOTICE 'tid_ref is %', tid_ref; + + END IF; + END IF; + + RETURN tid_ref; + +END; +$BODY$ + -- 12.1.2016 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/046_abwa_2015neu_3122_t_key_object_insert_metadata.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/046_abwa_2015neu_3122_t_key_object_insert_metadata.sql new file mode 100644 index 00000000..88a33476 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/046_abwa_2015neu_3122_t_key_object_insert_metadata.sql @@ -0,0 +1,25 @@ +-- 24.11.2016 auch create statement nötig, Tabelle fehlt in --createscript (an Eisenhut gemeldet) +-- Stefan Burckhardt + +-- Table: abwa_2015neu_3122.t_key_object + +DROP TABLE abwa_2015neu_3122.t_key_object; + +CREATE TABLE abwa_2015neu_3122.t_key_object +( + t_key character varying(30) NOT NULL, + t_lastuniqueid integer NOT NULL, + t_lastchange timestamp without time zone NOT NULL, + t_createdate timestamp without time zone NOT NULL, + t_user character varying(40) NOT NULL, + CONSTRAINT t_key_object_pkey PRIMARY KEY (t_key) +) +WITH ( + OIDS=FALSE +); +ALTER TABLE abwa_2015neu_3122.t_key_object + OWNER TO postgres; + +-- erster Eintrag in t_key_object + +INSERT INTO abwa_2015neu_3122.t_key_object (t_key, t_lastuniqueid, t_lastchange, t_createdate, t_user) VALUES ( 't_id', 0, current_timestamp, current_timestamp, 'postgres'); diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/050_abwa_2015neu_3122_import_vw_sia405_baseclass_metattribute.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/050_abwa_2015neu_3122_import_vw_sia405_baseclass_metattribute.sql new file mode 100644 index 00000000..bec66e5c --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/050_abwa_2015neu_3122_import_vw_sia405_baseclass_metattribute.sql @@ -0,0 +1,15 @@ +-- View: abwa_2015neu_3122.vw_sia405_baseclass_metaattribute + +-- DROP VIEW abwa_2015neu_3122.vw_sia405_baseclass_metaattribute; + +CREATE OR REPLACE VIEW abwa_2015neu_3122.vw_sia405_baseclass_metaattribute AS + SELECT sia405_baseclass.t_id, + sia405_baseclass.obj_id, + metaattribute.datenherr, + metaattribute.datenlieferant, + metaattribute.letzte_aenderung + FROM abwa_2015neu_3122.sia405_baseclass + LEFT JOIN abwa_2015neu_3122.metaattribute ON sia405_baseclass.t_id = metaattribute.sia405_baseclass_metaattribute; + +ALTER TABLE abwa_2015neu_3122.vw_sia405_baseclass_metaattribute + OWNER TO postgres; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/053_create_key_object_seq.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/053_create_key_object_seq.sql new file mode 100644 index 00000000..4c8977a6 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/053_create_key_object_seq.sql @@ -0,0 +1,52 @@ +-- Function: abwa_2015neu_3122.t_key_object_seq() +-- 3.6.2017 Stefan Burckhardt + +-- DROP FUNCTION abwa_2015neu_3122.abwa_2015neu_3122.t_key_object_seq() + +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.t_key_object_seq() + RETURNS integer AS +$BODY$ +DECLARE + nexttid integer; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + newtid = nextval('abwa_2015neu_3122.t_ili2db_seq'); + -- 23.12.2015 SELECT t_lastuniqueid FROM abwa_2015neu_3122.t_key_object AS nexttid; + -- SELECT t_lastuniqueid INTO nexttid FROM abwa_2015neu_3122.t_key_object; + --- nexttid = (newtid - 1); + + -- 12.1.2016 + RAISE NOTICE 'newtid is %', newtid; -- Print newtid + ---RAISE NOTICE 'nexttid is %', nexttid; -- Print nexttid + + -- adapt t_lastuniqueid in t_key_object + UPDATE abwa_2015neu_3122.t_key_object + SET t_lastuniqueid = newtid + , t_user = current_user + , t_createdate = current_timestamp + , t_lastchange = current_timestamp + WHERE t_lastuniqueid = 0; + + IF NOT FOUND THEN + RAISE EXCEPTION 'sequence for table could not be added - set t_key_object.t_last_uniqueid = 0'; + ELSE + RAISE NOTICE 't_key_object updated to latest sequence %', newtid; + END IF; + -- RETURN myrec_prefix.prefix || myrec_shortcut.shortcut_en || to_char(myrec_seq.seqval,'FM000000'); + -- RETURN myrec_prefix.prefix || to_char(myrec_seq.seqval,'FM000000'); + RETURN newtid; + + + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; + +ALTER FUNCTION abwa_2015neu_3122.t_key_object_seq() + OWNER TO postgres; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation-20170905.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation-20170905.sql new file mode 100644 index 00000000..12da085f --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation-20170905.sql @@ -0,0 +1,101 @@ +-- Function: abwa_2015neu_3122.meta_organisation(bez text, objid text) +-- 3.6.2017 Stefan Burckhardt / extended with subclass 5.9.2017 + +-- Adds organisations that do not exist yet (e.g. because they are used as dataowner/datenherr or provider/datenlieferant) in class organisation +-- e.g. SELECT abwa_2015neu_3122.meta_organisation('VSA', 'ch080qwzOG000098', 'privat'); +-- new parameter subclass - if + +-- DROP FUNCTION abwa_2015neu_3122.meta_organisation(bez text, objid text) + +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.meta_organisation(bez text, objid text, subclass text) + RETURNS integer AS +$BODY$ +DECLARE + datenherr_bezeichnung text; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('abwa_2015neu_3122.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + -- 23.12.2015 SELECT t_lastuniqueid FROM abwa_2015neu_3122.t_key_object AS nexttid; + SELECT bezeichnung INTO datenherr_bezeichnung FROM abwa_2015neu_3122.organisation WHERE organisation.bezeichnung = bez; + + IF NOT FOUND THEN + -- 13.2.2016 / 9.3.2016 improved error message + -- RAISE EXCEPTION 'tid_ref for table % not found', table_name; + RAISE NOTICE '[meta_organisation]: no organisation found with % ->',bez; + RAISE NOTICE 'Creating new data in organisation ...'; + --- RAISE EXCEPTION 'Missing t_id in table baseclass'; + newtid = abwa_2015neu_3122.tid_generate('Organisation', objid); + INSERT INTO abwa_2015neu_3122.baseclass (t_id, t_type) VALUES(newtid, 'Organisation'); + INSERT INTO abwa_2015neu_3122.sia405_baseclass (t_id, obj_id) VALUES(newtid, objid); + INSERT INTO abwa_2015neu_3122.organisation (t_id, bezeichnung) VALUES(newtid, bez); + + RAISE NOTICE 'subclass = %', subclass; + + IF subclass = 'privat' THEN + INSERT INTO abwa_2015neu_3122.privat (t_id, art) VALUES(newtid, 'Datenherr/Datenlieferant'); + ELSE + IF subclass = 'kanton' THEN + INSERT INTO abwa_2015neu_3122.kanton (t_id) VALUES(newtid); + ELSE + IF subclass = 'abwasserverband' THEN + INSERT INTO abwa_2015neu_3122.abwasserverband (t_id) VALUES(newtid); + ELSE + IF subclass = 'amt' THEN + INSERT INTO abwa_2015neu_3122.amt (t_id) VALUES(newtid); + ELSE + IF subclass = 'abwasserreinigungsanlage' THEN + INSERT INTO abwa_2015neu_3122.abwasserreinigungsanlage (t_id) VALUES(newtid); + ELSE + IF subclass = 'gemeinde' THEN + INSERT INTO abwa_2015neu_3122.gemeinde (t_id) VALUES(newtid); + ELSE + IF subclass = 'genossenschaft_korporation' THEN + INSERT INTO abwa_2015neu_3122.genossenschaft_korporation (t_id) VALUES(newtid); + ELSE + RAISE NOTICE 'no valid subclass( %) selected, added to subclass privat', subclass; + INSERT INTO abwa_2015neu_3122.privat (t_id, art) VALUES(newtid, 'Datenherr/Datenlieferant'); + END IF; + END IF; + END IF; + END IF; + END IF; + END IF; + END IF; + + RAISE NOTICE 'New data in Organisation added with obj_id %', objid; + + UPDATE abwa_2015neu_3122.metaattribute SET datenherr = objid WHERE datenherr = bez; + + RAISE NOTICE 'Table Metaattribute: Datenherr updated with obj_id %', objid; + + UPDATE abwa_2015neu_3122.metaattribute SET datenlieferant = objid WHERE datenlieferant = bez; + + RAISE NOTICE 'Table Metaattribute: Datenlieferant updated with obj_id %', objid; + + ELSE + -- 12.1.2016 + -- 13.2.2016 comment out to speed up + -- 9.3.2016 Hineis ergänzt mit OBJ_ID + -- 8.8.2017 + -- RAISE EXCEPTION '[meta_organisation]: Organisation already exists with %',bez; + RAISE NOTICE '[meta_organisation]: Organisation already exists with %',bez; + --- RAISE NOTICE 'tid_ref is %', tid_ref; + --- 8.8.2017 + UPDATE abwa_2015neu_3122.metaattribute SET datenherr = objid WHERE datenherr = bez; + RAISE NOTICE 'Table Metaattribute: Datenherr updated with obj_id %', objid; + UPDATE abwa_2015neu_3122.metaattribute SET datenlieferant = objid WHERE datenlieferant = bez; + RAISE NOTICE 'Table Metaattribute: Datenlieferant updated with obj_id %', objid; + END IF; +RETURN newtid; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; + +ALTER FUNCTION abwa_2015neu_3122.meta_organisation(text, text, text) + OWNER TO postgres; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation_ohne_subclass_20190711.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation_ohne_subclass_20190711.sql new file mode 100644 index 00000000..903592a7 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/054_create_function_meta_organisation_ohne_subclass_20190711.sql @@ -0,0 +1,67 @@ +-- Function: abwa_2015neu_3122.meta_organisation(bez text, objid text) +-- 3.6.2017 / 11.7.2019 Stefan Burckhardt + +-- Adds organisations that do not exist yet (e.g. because they are used as dataowner/datenherr or provider/datenlieferant) in class organisation and sublcass privat +-- e.g. SELECT abwa_2015neu_3122.meta_organisation('VSA', 'ch080qwzOG000098'); + +-- DROP FUNCTION abwa_2015neu_3122.meta_organisation(bez text, objid text) + +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.meta_organisation(bez text, objid text) + RETURNS integer AS +$BODY$ +DECLARE + datenherr_bezeichnung text; + newtid integer; + -- myrec_prefix record; + -- myrec_shortcut record; + -- myrec_seq record; +BEGIN + --get sequence for table + -- SELECT nextval('qgep.seq_' || table_name || '_oid') AS seqval INTO myrec_seq; + -- SELECT nextval('abwa_2015neu_3122.seq_' || table_name || '_tid') AS seqval INTO myrec_seq; + -- 23.12.2015 SELECT t_lastuniqueid FROM abwa_2015neu_3122.t_key_object AS nexttid; + SELECT bezeichnung INTO datenherr_bezeichnung FROM abwa_2015neu_3122.organisation WHERE organisation.bezeichnung = bez; + + IF NOT FOUND THEN + -- 13.2.2016 / 9.3.2016 improved error message + -- RAISE EXCEPTION 'tid_ref for table % not found', table_name; + RAISE NOTICE '[meta_organisation]: no organisation found with % ->',bez; + RAISE NOTICE 'Creating new data in organisation ...'; + --- RAISE EXCEPTION 'Missing t_id in table baseclass'; + newtid = abwa_2015neu_3122.tid_generate('Organisation', objid); + INSERT INTO abwa_2015neu_3122.baseclass (t_id, t_type) VALUES(newtid, 'Organisation'); + INSERT INTO abwa_2015neu_3122.sia405_baseclass (t_id, obj_id) VALUES(newtid, objid); + INSERT INTO abwa_2015neu_3122.organisation (t_id, bezeichnung) VALUES(newtid, bez); + -- INSERT INTO abwa_2015neu_3122.privat (t_id, art) VALUES(newtid, 'Datenherr/Datenlieferant'); + RAISE NOTICE 'New data in Organisation added wit obj_id %', objid; + + UPDATE abwa_2015neu_3122.metaattribute SET datenherr = objid WHERE datenherr = bez; + + RAISE NOTICE 'Table Metaattribute: Datenherr updated with obj_id %', objid; + + UPDATE abwa_2015neu_3122.metaattribute SET datenlieferant = objid WHERE datenlieferant = bez; + + RAISE NOTICE 'Table Metaattribute: Datenlieferant updated with obj_id %', objid; + + ELSE + -- 12.1.2016 + -- 13.2.2016 comment out to speed up + -- 9.3.2016 Hineis ergänzt mit OBJ_ID + -- 8.8.2017 + -- RAISE EXCEPTION '[meta_organisation]: Organisation already exists with %',bez; + RAISE NOTICE '[meta_organisation]: Organisation already exists with %',bez; + --- RAISE NOTICE 'tid_ref is %', tid_ref; + --- 8.8.2017 + UPDATE abwa_2015neu_3122.metaattribute SET datenherr = objid WHERE datenherr = bez; + RAISE NOTICE 'Table Metaattribute: Datenherr updated with obj_id %', objid; + UPDATE abwa_2015neu_3122.metaattribute SET datenlieferant = objid WHERE datenlieferant = bez; + RAISE NOTICE 'Table Metaattribute: Datenlieferant updated with obj_id %', objid; + END IF; +RETURN newtid; +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; + +ALTER FUNCTION abwa_2015neu_3122.meta_organisation(text, text) + OWNER TO postgres; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/055_neue_organisation_jerman_ag.png b/docs/stefans_scripts/import/sia405_abwasser_2015/055_neue_organisation_jerman_ag.png new file mode 100644 index 00000000..977bed45 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/055_neue_organisation_jerman_ag.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/055_select_meta_organisation_bezeichnung_obj_id_flue.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/055_select_meta_organisation_bezeichnung_obj_id_flue.sql new file mode 100644 index 00000000..619334c3 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/055_select_meta_organisation_bezeichnung_obj_id_flue.sql @@ -0,0 +1,25 @@ +-- 11.7.2919 Stefan Burckhardt +-- 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) + +-- set t_key_object to latest sequence of project so that tid (integer) is correct +SELECT abwa_2015neu_3122.t_key_object_seq(); + +-- set all the matching definitions for missing datenherr / datenlieferant organisations in organisation +-- examples: +-- fuer Hofstetten Flüh + +SELECT abwa_2015neu_3122.meta_organisation('Jermann AG', 'ch10m8nuPR000002'); + +-- SELECT abwa_2015neu_3122.meta_organisation('SBU', 'ch080qwzOG000099', 'privat'); +-- SELECT abwa_2015neu_3122.meta_organisation('Kanton Thurgau', 'ch080qwzKT000001', 'kanton'); +-- add your own or modify + +-- Alle Datenherr / Datenlieferant Einträge korrigieren, wo Wert nicht gleich der Bezeichnung in Klasse Organisation + +-- Check with SELECT * FROM abwa_2015neu_3122.sia405_base_lv95_metaattribute + +-- Datenherr Text durch enstprechende OBJ_ID ersetzen: ch19pppeMU000001 + +UPDATE abwa_2015neu_3122.sia405_base_lv95_metaattribute + SET datenherr = 'ch19pppeMU000001' + WHERE datenherr = 'Gemeinde Hofstetten Flueh'; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/056_update_bezeichnungen_unbekannt_sonst_constraintverletzung.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/056_update_bezeichnungen_unbekannt_sonst_constraintverletzung.sql new file mode 100644 index 00000000..41da4970 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/056_update_bezeichnungen_unbekannt_sonst_constraintverletzung.sql @@ -0,0 +1,15 @@ +-- 12.7.2019 testing - nicht brauchbar bis jetzt +-- allgemein +-- UPDATE table +-- SET column1 = value1, +-- column2 = value2 ,... +-- WHERE +-- condition; + + +SELECT bezeichnung, t_id FROM abwa_2015neu_3122.abwasserbauwerk WHERE bezeichnung = 'unbekannt'; + +UPDATE abwa_2015neu_3122.abwasserbauwerk +SET bezeichnung = obj_id +WHERE + bezeichnung = 'unbekannt'; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/060_sia405_interlisimport.sql_22.02.2017_75890.31.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/060_sia405_interlisimport.sql_22.02.2017_75890.31.sql new file mode 100644 index 00000000..9d9dbf28 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/060_sia405_interlisimport.sql_22.02.2017_75890.31.sql @@ -0,0 +1,672 @@ +------ This file is sql code to Import INTERLIS (Modul SIA405Abwasser) in German to QGEP in Englisch on QQIS +------ For questions etc. please contact Stefan Burckhardt stefan.burckhardt@sjib.ch +------ version 22.02.2017 21:04:50 / 11.7.2019 adapted to new schema +-- 12.7.2019 - datenlieferant / datenherr angepasst +-- Datenherr, datenlieferant +-- abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +-- abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) + +-- 1. loeschen vorhandener daten +DELETE FROM qgep_od.organisation; +DELETE FROM qgep_od.wastewater_structure; +DELETE FROM qgep_od.wastewater_structure_text; +DELETE FROM qgep_od.wastewater_structure_symbol; +DELETE FROM qgep_od.channel; +DELETE FROM qgep_od.manhole; +DELETE FROM qgep_od.discharge_point; +DELETE FROM qgep_od.special_structure; +DELETE FROM qgep_od.infiltration_installation; +DELETE FROM qgep_od.pipe_profile; +DELETE FROM qgep_od.wastewater_networkelement; +DELETE FROM qgep_od.reach_point; +DELETE FROM qgep_od.wastewater_node; +DELETE FROM qgep_od.reach; +DELETE FROM qgep_od.reach_text; +DELETE FROM qgep_od.structure_part; +DELETE FROM qgep_od.dryweather_downspout; +DELETE FROM qgep_od.access_aid; +DELETE FROM qgep_od.dryweather_flume; +DELETE FROM qgep_od.cover; +DELETE FROM qgep_od.benching; + + +-- 2. kopieren von ili2pg schema nach qgep schema - klasse organisation zuerst, da neu auch verknüpft mit datenherr / datenlieferant + +INSERT INTO qgep_od.organisation +( +obj_id, identifier, remark, uid, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, bezeichnung, bemerkung, uid, Letzte_Aenderung, Datenherr, datenlieferant +--falls nicht schon umgesetzt als OBJ_ID +--abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +--abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.Organisation + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Organisation.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.wastewater_structure +( +obj_id, accessibility, contract_section, detail_geometry_geometry, financing, gross_costs, identifier, inspection_interval, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement, fk_owner, fk_operator, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, +CASE WHEN Zugaenglichkeit = 'ueberdeckt' THEN 3444 ---- 3444 covered +WHEN Zugaenglichkeit = 'unbekannt' THEN 3447 ---- 3447 unknown +WHEN Zugaenglichkeit = 'unzugaenglich' THEN 3446 ---- 3446 inaccessible +WHEN Zugaenglichkeit = 'zugaenglich' THEN 3445 ---- 3445 accessible +END AS Zugaenglichkeit, baulos, ST_Force3D(detailgeometrie), +CASE WHEN Finanzierung = 'oeffentlich' THEN 5510 ---- 5510 public +WHEN Finanzierung = 'privat' THEN 5511 ---- 5511 private +WHEN Finanzierung = 'unbekannt' THEN 5512 ---- 5512 unknown +END AS Finanzierung, bruttokosten, bezeichnung, inspektionsintervall, standortname, akten, bemerkung, +CASE WHEN Sanierungsbedarf = 'dringend' THEN 5370 ---- 5370 urgent +WHEN Sanierungsbedarf = 'keiner' THEN 5368 ---- 5368 none +WHEN Sanierungsbedarf = 'kurzfristig' THEN 2 ---- 2 short_term +WHEN Sanierungsbedarf = 'langfristig' THEN 4 ---- 4 long_term +WHEN Sanierungsbedarf = 'mittelfristig' THEN 3 ---- 3 medium_term +WHEN Sanierungsbedarf = 'unbekannt' THEN 5369 ---- 5369 unknown +END AS Sanierungsbedarf, wiederbeschaffungswert, wbw_basisjahr, +CASE WHEN WBW_Bauart = 'andere' THEN 4602 ---- 4602 other +WHEN WBW_Bauart = 'Feld' THEN 4603 ---- 4603 field +WHEN WBW_Bauart = 'Sanierungsleitung_Bagger' THEN 4606 ---- 4606 renovation_conduction_excavator +WHEN WBW_Bauart = 'Sanierungsleitung_Grabenfraese' THEN 4605 ---- 4605 renovation_conduction_ditch_cutter +WHEN WBW_Bauart = 'Strasse' THEN 4604 ---- 4604 road +WHEN WBW_Bauart = 'unbekannt' THEN 4601 ---- 4601 unknown +END AS WBW_Bauart, +CASE WHEN Status = 'ausser_Betrieb' THEN 3633 ---- 3633 inoperative +WHEN Status = 'in_Betrieb' THEN 8493 ---- 8493 operational +WHEN Status = 'in_Betrieb.provisorisch' THEN 6530 ---- 6530 operational.tentative +WHEN Status = 'in_Betrieb.wird_aufgehoben' THEN 6533 ---- 6533 operational.will_be_suspended +WHEN Status = 'tot.aufgehoben_nicht_verfuellt' THEN 6523 ---- 6523 abanndoned.suspended_not_filled +WHEN Status = 'tot.aufgehoben_unbekannt' THEN 6524 ---- 6524 abanndoned.suspended_unknown +WHEN Status = 'tot.verfuellt' THEN 6532 ---- 6532 abanndoned.filled +WHEN Status = 'unbekannt' THEN 3027 ---- 3027 unknown +WHEN Status = 'weitere.Berechnungsvariante' THEN 6526 ---- 6526 other.calculation_alternative +WHEN Status = 'weitere.geplant' THEN 7959 ---- 7959 other.planned +WHEN Status = 'weitere.Projekt' THEN 6529 ---- 6529 other.project +END AS Status, +CASE WHEN BaulicherZustand = 'unbekannt' THEN 3037 ---- 3037 unknown +WHEN BaulicherZustand = 'Z0' THEN 3363 ---- 3363 Z0 +WHEN BaulicherZustand = 'Z1' THEN 3359 ---- 3359 Z1 +WHEN BaulicherZustand = 'Z2' THEN 3360 ---- 3360 Z2 +WHEN BaulicherZustand = 'Z3' THEN 3361 ---- 3361 Z3 +WHEN BaulicherZustand = 'Z4' THEN 3362 ---- 3362 Z4 +END AS BaulicherZustand, subventionen, baujahr, ersatzjahr, abwa_2015neu_3122.objid_lookup('Organisation', eigentuemerref::int), abwa_2015neu_3122.objid_lookup('Organisation', betreiberref::int), Letzte_Aenderung, +--Datenherr, datenlieferant +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.Abwasserbauwerk + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Abwasserbauwerk.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.wastewater_structure_text +( +obj_id, fk_wastewater_structure, plantype, text, remark, textori, texthali, textvali, textpos_geometry, last_modification) +SELECT +--abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', Abwasserbauwerkref::int) as obj_id, +qgep_sys.generate_oid('qgep_od','txt_text'), +abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', abwasserbauwerkref::int) as abwasserbauwerkref, +CASE WHEN a.Plantyp = 'Leitungskataster' THEN 7844 ---- 7844 pipeline_registry +WHEN a.Plantyp = 'Uebersichtsplan.UeP10' THEN 7846 ---- 7846 overviewmap.om10 +WHEN a.Plantyp = 'Uebersichtsplan.UeP2' THEN 7847 ---- 7847 overviewmap.om2 +WHEN a.Plantyp = 'Uebersichtsplan.UeP5' THEN 7848 ---- 7848 overviewmap.om5 +WHEN a.Plantyp = 'Werkplan' THEN 7845 ---- 7845 network_plan +END AS Plantyp, +a.textinhalt, a.bemerkung, +b.textori, +CASE WHEN b.textvali = 'TOP' THEN 0 +WHEN b.textvali = 'CAP' THEN 1 +WHEN b.textvali = 'HALF' THEN 2 +WHEN b.textvali = 'BASE' THEN 3 +END AS textvali, +CASE WHEN b.texthali = 'LEFT' THEN 0 +WHEN b.texthali = 'CENTER' THEN 1 +WHEN b.texthali = 'RIGHT' THEN 2 +END AS texthali, +--ST_FORCE3D(b.textpos), +(b.textpos), +Letzte_Aenderung +FROM abwa_2015neu_3122.Abwasserbauwerk_text + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Abwasserbauwerk_text.t_id = vw_sia405_baseclass_metaattribute.t_id + LEFT JOIN abwa_2015neu_3122.sia405_textpos as a ON abwa_2015neu_3122.Abwasserbauwerk_text.t_id = a.t_id + LEFT JOIN abwa_2015neu_3122.textpos as b ON abwa_2015neu_3122.Abwasserbauwerk_text.t_id = b.t_id; + +INSERT INTO qgep_od.wastewater_structure_symbol +( +obj_id, fk_wastewater_structure, plantype, symbol_scaling_heigth, symbol_scaling_width, symbolori, symbolpos_geometry, last_modification) +SELECT +--abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', Abwasserbauwerkref::int) as obj_id, +qgep_sys.generate_oid('qgep_od','txt_symbol'), +abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', abwasserbauwerkref::int) as abwasserbauwerkref, +CASE WHEN a.Plantyp = 'Leitungskataster' THEN 7874 ---- 7874 pipeline_registry +WHEN a.Plantyp = 'Uebersichtsplan.UeP10' THEN 7876 ---- 7876 overviewmap.om10 +WHEN a.Plantyp = 'Uebersichtsplan.UeP2' THEN 7877 ---- 7877 overviewmap.om2 +WHEN a.Plantyp = 'Uebersichtsplan.UeP5' THEN 7878 ---- 7878 overviewmap.om5 +WHEN a.Plantyp = 'Werkplan' THEN 7875 ---- 7875 network_plan +END AS Plantyp, +a.symbolskalierunghoch, a.symbolskalierunglaengs, +b.symbolori, +ST_Force3D(b.symbolpos), +Letzte_Aenderung +FROM abwa_2015neu_3122.Abwasserbauwerk_symbol + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Abwasserbauwerk_symbol.t_id = vw_sia405_baseclass_metaattribute.t_id + LEFT JOIN abwa_2015neu_3122.sia405_symbolpos as a ON abwa_2015neu_3122.Abwasserbauwerk_symbol.t_id = a.t_id + LEFT JOIN abwa_2015neu_3122.symbolpos as b ON abwa_2015neu_3122.Abwasserbauwerk_symbol.t_id = b.t_id; + +INSERT INTO qgep_od.channel +( +obj_id, bedding_encasement, connection_type, function_hierarchic, function_hydraulic, jetting_interval, pipe_length, usage_current, usage_planned) +SELECT obj_id, +CASE WHEN Bettung_Umhuellung = 'andere' THEN 5325 ---- 5325 other +WHEN Bettung_Umhuellung = 'erdverlegt' THEN 5332 ---- 5332 in_soil +WHEN Bettung_Umhuellung = 'in_Kanal_aufgehaengt' THEN 5328 ---- 5328 in_channel_suspended +WHEN Bettung_Umhuellung = 'in_Kanal_einbetoniert' THEN 5339 ---- 5339 in_channel_concrete_casted +WHEN Bettung_Umhuellung = 'in_Leitungsgang' THEN 5331 ---- 5331 in_walk_in_passage +WHEN Bettung_Umhuellung = 'in_Vortriebsrohr_Beton' THEN 5337 ---- 5337 in_jacking_pipe_concrete +WHEN Bettung_Umhuellung = 'in_Vortriebsrohr_Stahl' THEN 5336 ---- 5336 in_jacking_pipe_steel +WHEN Bettung_Umhuellung = 'Sand' THEN 5335 ---- 5335 sand +WHEN Bettung_Umhuellung = 'SIA_Typ1' THEN 5333 ---- 5333 sia_type_1 +WHEN Bettung_Umhuellung = 'SIA_Typ2' THEN 5330 ---- 5330 sia_type_2 +WHEN Bettung_Umhuellung = 'SIA_Typ3' THEN 5334 ---- 5334 sia_type_3 +WHEN Bettung_Umhuellung = 'SIA_Typ4' THEN 5340 ---- 5340 sia_type_4 +WHEN Bettung_Umhuellung = 'Sohlbrett' THEN 5327 ---- 5327 bed_plank +WHEN Bettung_Umhuellung = 'unbekannt' THEN 5329 ---- 5329 unknown +END AS Bettung_Umhuellung, +CASE WHEN Verbindungsart = 'andere' THEN 5341 ---- 5341 other +WHEN Verbindungsart = 'Elektroschweissmuffen' THEN 190 ---- 190 electric_welded_sleeves +WHEN Verbindungsart = 'Flachmuffen' THEN 187 ---- 187 flat_sleeves +WHEN Verbindungsart = 'Flansch' THEN 193 ---- 193 flange +WHEN Verbindungsart = 'Glockenmuffen' THEN 185 ---- 185 bell_shaped_sleeves +WHEN Verbindungsart = 'Kupplung' THEN 192 ---- 192 coupling +WHEN Verbindungsart = 'Schraubmuffen' THEN 194 ---- 194 screwed_sleeves +WHEN Verbindungsart = 'spiegelgeschweisst' THEN 189 ---- 189 butt_welded +WHEN Verbindungsart = 'Spitzmuffen' THEN 186 ---- 186 beaked_sleeves +WHEN Verbindungsart = 'Steckmuffen' THEN 191 ---- 191 push_fit_sleeves +WHEN Verbindungsart = 'Ueberschiebmuffen' THEN 188 ---- 188 slip_on_sleeves +WHEN Verbindungsart = 'unbekannt' THEN 3036 ---- 3036 unknown +WHEN Verbindungsart = 'Vortriebsrohrkupplung' THEN 3666 ---- 3666 jacking_pipe_coupling +END AS Verbindungsart, +CASE WHEN FunktionHierarchisch = 'PAA.andere' THEN 5066 ---- 5066 pwwf.other +WHEN FunktionHierarchisch = 'PAA.Gewaesser' THEN 5068 ---- 5068 pwwf.water_bodies +WHEN FunktionHierarchisch = 'PAA.Hauptsammelkanal' THEN 5069 ---- 5069 pwwf.main_drain +WHEN FunktionHierarchisch = 'PAA.Hauptsammelkanal_regional' THEN 5070 ---- 5070 pwwf.main_drain_regional +WHEN FunktionHierarchisch = 'PAA.Liegenschaftsentwaesserung' THEN 5064 ---- 5064 pwwf.residential_drainage +WHEN FunktionHierarchisch = 'PAA.Sammelkanal' THEN 5071 ---- 5071 pwwf.collector_sewer +WHEN FunktionHierarchisch = 'PAA.Sanierungsleitung' THEN 5062 ---- 5062 pwwf.renovation_conduction +WHEN FunktionHierarchisch = 'PAA.Strassenentwaesserung' THEN 5072 ---- 5072 pwwf.road_drainage +WHEN FunktionHierarchisch = 'PAA.unbekannt' THEN 5074 ---- 5074 pwwf.unknown +WHEN FunktionHierarchisch = 'SAA.andere' THEN 5067 ---- 5067 swwf.other +WHEN FunktionHierarchisch = 'SAA.Liegenschaftsentwaesserung' THEN 5065 ---- 5065 swwf.residential_drainage +WHEN FunktionHierarchisch = 'SAA.Sanierungsleitung' THEN 5063 ---- 5063 swwf.renovation_conduction +WHEN FunktionHierarchisch = 'SAA.Strassenentwaesserung' THEN 5073 ---- 5073 swwf.road_drainage +WHEN FunktionHierarchisch = 'SAA.unbekannt' THEN 5075 ---- 5075 swwf.unknown +END AS FunktionHierarchisch, +CASE WHEN FunktionHydraulisch = 'andere' THEN 5320 ---- 5320 other +WHEN FunktionHydraulisch = 'Drainagetransportleitung' THEN 2546 ---- 2546 drainage_transportation_pipe +WHEN FunktionHydraulisch = 'Drosselleitung' THEN 22 ---- 22 restriction_pipe +WHEN FunktionHydraulisch = 'Duekerleitung' THEN 3610 ---- 3610 inverted_syphon +WHEN FunktionHydraulisch = 'Freispiegelleitung' THEN 367 ---- 367 gravity_pipe +WHEN FunktionHydraulisch = 'Pumpendruckleitung' THEN 23 ---- 23 pump_pressure_pipe +WHEN FunktionHydraulisch = 'Sickerleitung' THEN 145 ---- 145 seepage_water_drain +WHEN FunktionHydraulisch = 'Speicherleitung' THEN 21 ---- 21 retention_pipe +WHEN FunktionHydraulisch = 'Spuelleitung' THEN 144 ---- 144 jetting_pipe +WHEN FunktionHydraulisch = 'unbekannt' THEN 5321 ---- 5321 unknown +WHEN FunktionHydraulisch = 'Vakuumleitung' THEN 3655 ---- 3655 vacuum_pipe +END AS FunktionHydraulisch, spuelintervall, rohrlaenge, +CASE WHEN Nutzungsart_Ist = 'andere' THEN 5322 ---- 5322 other +WHEN Nutzungsart_Ist = 'Bachwasser' THEN 4518 ---- 4518 creek_water +WHEN Nutzungsart_Ist = 'entlastetes_Mischabwasser' THEN 4516 ---- 4516 discharged_combined_wastewater +WHEN Nutzungsart_Ist = 'Industrieabwasser' THEN 4524 ---- 4524 industrial_wastewater +WHEN Nutzungsart_Ist = 'Mischabwasser' THEN 4522 ---- 4522 combined_wastewater +WHEN Nutzungsart_Ist = 'Regenabwasser' THEN 4520 ---- 4520 rain_wastewater +WHEN Nutzungsart_Ist = 'Reinabwasser' THEN 4514 ---- 4514 clean_wastewater +WHEN Nutzungsart_Ist = 'Schmutzabwasser' THEN 4526 ---- 4526 wastewater +WHEN Nutzungsart_Ist = 'unbekannt' THEN 4571 ---- 4571 unknown +END AS Nutzungsart_Ist, +CASE WHEN Nutzungsart_geplant = 'andere' THEN 5323 ---- 5323 other +WHEN Nutzungsart_geplant = 'Bachwasser' THEN 4519 ---- 4519 creek_water +WHEN Nutzungsart_geplant = 'entlastetes_Mischabwasser' THEN 4517 ---- 4517 discharged_combined_wastewater +WHEN Nutzungsart_geplant = 'Industrieabwasser' THEN 4525 ---- 4525 industrial_wastewater +WHEN Nutzungsart_geplant = 'Mischabwasser' THEN 4523 ---- 4523 combined_wastewater +WHEN Nutzungsart_geplant = 'Regenabwasser' THEN 4521 ---- 4521 rain_wastewater +WHEN Nutzungsart_geplant = 'Reinabwasser' THEN 4515 ---- 4515 clean_wastewater +WHEN Nutzungsart_geplant = 'Schmutzabwasser' THEN 4527 ---- 4527 wastewater +WHEN Nutzungsart_geplant = 'unbekannt' THEN 4569 ---- 4569 unknown +END AS Nutzungsart_geplant +FROM abwa_2015neu_3122.Kanal + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Kanal.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.manhole +( +obj_id, dimension1, dimension2, function, material, surface_inflow) +SELECT obj_id, dimension1, dimension2, +CASE WHEN Funktion = 'Absturzbauwerk' THEN 4532 ---- 4532 drop_structure +WHEN Funktion = 'andere' THEN 5344 ---- 5344 other +WHEN Funktion = 'Be_Entlueftung' THEN 4533 ---- 4533 venting +WHEN Funktion = 'Dachwasserschacht' THEN 3267 ---- 3267 rain_water_manhole +WHEN Funktion = 'Einlaufschacht' THEN 3266 ---- 3266 gully +WHEN Funktion = 'Entwaesserungsrinne' THEN 3472 ---- 3472 drainage_channel +WHEN Funktion = 'Geleiseschacht' THEN 228 ---- 228 rail_track_gully +WHEN Funktion = 'Kontrollschacht' THEN 204 ---- 204 manhole +WHEN Funktion = 'Oelabscheider' THEN 1008 ---- 1008 oil_separator +WHEN Funktion = 'Pumpwerk' THEN 4536 ---- 4536 pump_station +WHEN Funktion = 'Regenueberlauf' THEN 5346 ---- 5346 stormwater_overflow +WHEN Funktion = 'Schlammsammler' THEN 2742 ---- 2742 slurry_collector +WHEN Funktion = 'Schwimmstoffabscheider' THEN 5347 ---- 5347 floating_material_separator +WHEN Funktion = 'Spuelschacht' THEN 4537 ---- 4537 jetting_manhole +WHEN Funktion = 'Trennbauwerk' THEN 4798 ---- 4798 separating_structure +WHEN Funktion = 'unbekannt' THEN 5345 ---- 5345 unknown +END AS Funktion, +CASE WHEN Material = 'andere' THEN 4540 ---- 4540 other +WHEN Material = 'Beton' THEN 4541 ---- 4541 concrete +WHEN Material = 'Kunststoff' THEN 4542 ---- 4542 plastic +WHEN Material = 'unbekannt' THEN 4543 ---- 4543 unknown +END AS Material, +CASE WHEN Oberflaechenzulauf = 'andere' THEN 5342 ---- 5342 other +WHEN Oberflaechenzulauf = 'keiner' THEN 2741 ---- 2741 none +WHEN Oberflaechenzulauf = 'Rost' THEN 2739 ---- 2739 grid +WHEN Oberflaechenzulauf = 'unbekannt' THEN 5343 ---- 5343 unknown +WHEN Oberflaechenzulauf = 'Zulauf_seitlich' THEN 2740 ---- 2740 intake_from_side +END AS Oberflaechenzulauf +FROM abwa_2015neu_3122.Normschacht + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Normschacht.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.discharge_point +( +obj_id, highwater_level, relevance, terrain_level, waterlevel_hydraulic +-- fuer sia405 auskommentiert +-- , fk_sector_water_body +) +SELECT obj_id, hochwasserkote, +CASE WHEN Relevanz = 'gewaesserrelevant' THEN 5580 ---- 5580 relevant_for_water_course +WHEN Relevanz = 'nicht_gewaesserrelevant' THEN 5581 ---- 5581 non_relevant_for_water_course +END AS Relevanz, terrainkote, wasserspiegel_hydraulik +-- fuer sia405 auskommentiert +-- , abwa_2015neu_3122.objid_lookup('Gewaessersektor', gewaessersektorref::int) +FROM abwa_2015neu_3122.Einleitstelle + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Einleitstelle.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.special_structure +( +obj_id, bypass, emergency_spillway, function, stormwater_tank_arrangement) +SELECT obj_id, +CASE WHEN Bypass = 'nicht_vorhanden' THEN 2682 ---- 2682 inexistent +WHEN Bypass = 'unbekannt' THEN 3055 ---- 3055 unknown +WHEN Bypass = 'vorhanden' THEN 2681 ---- 2681 existent +END AS Bypass, +CASE WHEN Notueberlauf = 'andere' THEN 5866 ---- 5866 other +WHEN Notueberlauf = 'inMischabwasserkanalisation' THEN 5864 ---- 5864 in_combined_waste_water_drain +WHEN Notueberlauf = 'inRegenabwasserkanalisation' THEN 5865 ---- 5865 in_rain_waste_water_drain +WHEN Notueberlauf = 'inSchmutzabwasserkanalisation' THEN 5863 ---- 5863 in_waste_water_drain +WHEN Notueberlauf = 'keiner' THEN 5878 ---- 5878 none +WHEN Notueberlauf = 'unbekannt' THEN 5867 ---- 5867 unknown +END AS Notueberlauf, +CASE WHEN Funktion = 'abflussloseGrube' THEN 6397 ---- 6397 pit_without_drain +WHEN Funktion = 'Absturzbauwerk' THEN 245 ---- 245 drop_structure +WHEN Funktion = 'Abwasserfaulraum' THEN 6398 ---- 6398 hydrolizing_tank +WHEN Funktion = 'andere' THEN 5371 ---- 5371 other +WHEN Funktion = 'Be_Entlueftung' THEN 386 ---- 386 venting +WHEN Funktion = 'Duekerkammer' THEN 3234 ---- 3234 inverse_syphon_chamber +WHEN Funktion = 'Duekeroberhaupt' THEN 5091 ---- 5091 syphon_head +WHEN Funktion = 'Faulgrube' THEN 6399 ---- 6399 septic_tank_two_chambers +WHEN Funktion = 'Gelaendemulde' THEN 3348 ---- 3348 terrain_depression +WHEN Funktion = 'Geschiebefang' THEN 336 ---- 336 bolders_bedload_catchement_dam +WHEN Funktion = 'Guellegrube' THEN 5494 ---- 5494 cesspit +WHEN Funktion = 'Klaergrube' THEN 6478 ---- 6478 septic_tank +WHEN Funktion = 'Kontrollschacht' THEN 2998 ---- 2998 manhole +WHEN Funktion = 'Oelabscheider' THEN 2768 ---- 2768 oil_separator +WHEN Funktion = 'Pumpwerk' THEN 246 ---- 246 pump_station +WHEN Funktion = 'Regenbecken_Durchlaufbecken' THEN 3673 ---- 3673 stormwater_tank_with_overflow +WHEN Funktion = 'Regenbecken_Fangbecken' THEN 3674 ---- 3674 stormwater_tank_retaining_first_flush +WHEN Funktion = 'Regenbecken_Fangkanal' THEN 5574 ---- 5574 stormwater_retaining_channel +WHEN Funktion = 'Regenbecken_Regenklaerbecken' THEN 3675 ---- 3675 stormwater_sedimentation_tank +WHEN Funktion = 'Regenbecken_Regenrueckhaltebecken' THEN 3676 ---- 3676 stormwater_retention_tank +WHEN Funktion = 'Regenbecken_Regenrueckhaltekanal' THEN 5575 ---- 5575 stormwater_retention_channel +WHEN Funktion = 'Regenbecken_Stauraumkanal' THEN 5576 ---- 5576 stormwater_storage_channel +WHEN Funktion = 'Regenbecken_Verbundbecken' THEN 3677 ---- 3677 stormwater_composite_tank +WHEN Funktion = 'Regenueberlauf' THEN 5372 ---- 5372 stormwater_overflow +WHEN Funktion = 'Schwimmstoffabscheider' THEN 5373 ---- 5373 floating_material_separator +WHEN Funktion = 'seitlicherZugang' THEN 383 ---- 383 side_access +WHEN Funktion = 'Spuelschacht' THEN 227 ---- 227 jetting_manhole +WHEN Funktion = 'Trennbauwerk' THEN 4799 ---- 4799 separating_structure +WHEN Funktion = 'unbekannt' THEN 3008 ---- 3008 unknown +WHEN Funktion = 'Wirbelfallschacht' THEN 2745 ---- 2745 vortex_manhole +END AS Funktion, +CASE WHEN Regenbecken_Anordnung = 'Hauptschluss' THEN 4608 ---- 4608 main_connection +WHEN Regenbecken_Anordnung = 'Nebenschluss' THEN 4609 ---- 4609 side_connection +WHEN Regenbecken_Anordnung = 'unbekannt' THEN 4610 ---- 4610 unknown +END AS Regenbecken_Anordnung +FROM abwa_2015neu_3122.Spezialbauwerk + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Spezialbauwerk.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.infiltration_installation +( +obj_id, absorption_capacity, defects, dimension1, dimension2, distance_to_aquifer, effective_area, emergency_spillway, kind, labeling, seepage_utilization, vehicle_access, watertightness +-- fuer sia405 auskommentiert +--, fk_aquifier +) +SELECT obj_id, schluckvermoegen, +CASE WHEN Maengel = 'keine' THEN 5361 ---- 5361 none +WHEN Maengel = 'unwesentliche' THEN 3276 ---- 3276 marginal +WHEN Maengel = 'wesentliche' THEN 3275 ---- 3275 substantial +END AS Maengel, dimension1, dimension2, gwdistanz, wirksameflaeche, +CASE WHEN Notueberlauf = 'inMischwasserkanalisation' THEN 5365 ---- 5365 in_combined_waste_water_drain +WHEN Notueberlauf = 'inRegenwasserkanalisation' THEN 3307 ---- 3307 in_rain_waste_water_drain +WHEN Notueberlauf = 'inVorfluter' THEN 3304 ---- 3304 in_water_body +WHEN Notueberlauf = 'keiner' THEN 3303 ---- 3303 none +WHEN Notueberlauf = 'oberflaechlichausmuendend' THEN 3305 ---- 3305 surface_discharge +WHEN Notueberlauf = 'unbekannt' THEN 3308 ---- 3308 unknown +END AS Notueberlauf, +CASE WHEN Art = 'andere_mit_Bodenpassage' THEN 3282 ---- 3282 with_soil_passage +WHEN Art = 'andere_ohne_Bodenpassage' THEN 3285 ---- 3285 without_soil_passage +WHEN Art = 'Flaechenfoermige_Versickerung' THEN 3279 ---- 3279 surface_infiltration +WHEN Art = 'Kieskoerper' THEN 277 ---- 277 gravel_formation +WHEN Art = 'Kombination_Schacht_Strang' THEN 3284 ---- 3284 combination_manhole_pipe +WHEN Art = 'MuldenRigolenversickerung' THEN 3281 ---- 3281 swale_french_drain_infiltration +WHEN Art = 'unbekannt' THEN 3087 ---- 3087 unknown +WHEN Art = 'Versickerung_ueber_die_Schulter' THEN 3280 ---- 3280 percolation_over_the_shoulder +WHEN Art = 'Versickerungsbecken' THEN 276 ---- 276 infiltration_basin +WHEN Art = 'Versickerungsschacht' THEN 278 ---- 278 adsorbing_well +WHEN Art = 'Versickerungsstrang_Galerie' THEN 3283 ---- 3283 infiltration_pipe_sections_gallery +END AS Art, +CASE WHEN Beschriftung = 'beschriftet' THEN 5362 ---- 5362 labeled +WHEN Beschriftung = 'nichtbeschriftet' THEN 5363 ---- 5363 not_labeled +WHEN Beschriftung = 'unbekannt' THEN 5364 ---- 5364 unknown +END AS Beschriftung, +CASE WHEN Versickerungswasser = 'Regenabwasser' THEN 274 ---- 274 rain_water +WHEN Versickerungswasser = 'Reinabwasser' THEN 273 ---- 273 clean_water +WHEN Versickerungswasser = 'unbekannt' THEN 5359 ---- 5359 unknown +END AS Versickerungswasser, +CASE WHEN Saugwagen = 'unbekannt' THEN 3289 ---- 3289 unknown +WHEN Saugwagen = 'unzugaenglich' THEN 3288 ---- 3288 inaccessible +WHEN Saugwagen = 'zugaenglich' THEN 3287 ---- 3287 accessible +END AS Saugwagen, +CASE WHEN Wasserdichtheit = 'nichtwasserdicht' THEN 3295 ---- 3295 not_watertight +WHEN Wasserdichtheit = 'unbekannt' THEN 5360 ---- 5360 unknown +WHEN Wasserdichtheit = 'wasserdicht' THEN 3294 ---- 3294 watertight +END AS Wasserdichtheit +-- fuer sia405 auskommentiert +--, abwa_2015neu_3122.objid_lookup('Grundwasserleiter', grundwasserleiterref::int) +FROM abwa_2015neu_3122.Versickerungsanlage + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Versickerungsanlage.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.pipe_profile +( +obj_id, height_width_ratio, identifier, profile_type, remark, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, hoehenbreitenverhaeltnis, bezeichnung, +CASE WHEN Profiltyp = 'Eiprofil' THEN 3351 ---- 3351 egg +WHEN Profiltyp = 'Kreisprofil' THEN 3350 ---- 3350 circle +WHEN Profiltyp = 'Maulprofil' THEN 3352 ---- 3352 mouth +WHEN Profiltyp = 'offenes_Profil' THEN 3354 ---- 3354 open +WHEN Profiltyp = 'Rechteckprofil' THEN 3353 ---- 3353 rectangular +WHEN Profiltyp = 'Spezialprofil' THEN 3355 ---- 3355 special +WHEN Profiltyp = 'unbekannt' THEN 3357 ---- 3357 unknown +END AS Profiltyp, bemerkung, Letzte_Aenderung, +--Datenherr, datenlieferant +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.Rohrprofil + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Rohrprofil.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.wastewater_networkelement +( +obj_id, identifier, remark, fk_wastewater_structure, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, bezeichnung, bemerkung, abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', abwasserbauwerkref::int), Letzte_Aenderung, +--Datenherr, datenlieferant +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.Abwassernetzelement + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Abwassernetzelement.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.reach_point +( +obj_id, elevation_accuracy, identifier, level, outlet_shape, position_of_connection, remark, situation_geometry, fk_wastewater_networkelement, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, +CASE WHEN Hoehengenauigkeit = 'groesser_6cm' THEN 3248 ---- 3248 more_than_6cm +WHEN Hoehengenauigkeit = 'plusminus_1cm' THEN 3245 ---- 3245 plusminus_1cm +WHEN Hoehengenauigkeit = 'plusminus_3cm' THEN 3246 ---- 3246 plusminus_3cm +WHEN Hoehengenauigkeit = 'plusminus_6cm' THEN 3247 ---- 3247 plusminus_6cm +WHEN Hoehengenauigkeit = 'unbekannt' THEN 5376 ---- 5376 unknown +END AS Hoehengenauigkeit, bezeichnung, kote, +CASE WHEN Auslaufform = 'abgerundet' THEN 5374 ---- 5374 round_edged +WHEN Auslaufform = 'blendenfoermig' THEN 298 ---- 298 orifice +WHEN Auslaufform = 'keine_Querschnittsaenderung' THEN 3358 ---- 3358 no_cross_section_change +WHEN Auslaufform = 'scharfkantig' THEN 286 ---- 286 sharp_edged +WHEN Auslaufform = 'unbekannt' THEN 5375 ---- 5375 unknown +END AS Auslaufform, lage_anschluss, bemerkung, ST_Force3D(lage), abwa_2015neu_3122.objid_lookup('Abwassernetzelement', abwassernetzelementref::int), Letzte_Aenderung, --Datenherr, datenlieferant +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.Haltungspunkt + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Haltungspunkt.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.wastewater_node +( +obj_id, backflow_level, bottom_level, situation_geometry +-- rausgenommen für sia405 abwasser +--, fk_hydr_geometry +) +SELECT obj_id, rueckstaukote, sohlenkote, ST_Force3D(lage) +--, abwa_2015neu_3122.objid_lookup('Hydr_Geometrie', hydr_geometrieref::int) +FROM abwa_2015neu_3122.Abwasserknoten + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Abwasserknoten.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.reach +( +obj_id, clear_height, coefficient_of_friction, horizontal_positioning, inside_coating, length_effective, material, progression_geometry, reliner_material, reliner_nominal_size, relining_construction, relining_kind, ring_stiffness, slope_building_plan, wall_roughness, fk_reach_point_from, fk_reach_point_to, fk_pipe_profile) +SELECT obj_id, lichte_hoehe, reibungsbeiwert, +CASE WHEN Lagebestimmung = 'genau' THEN 5378 ---- 5378 accurate +WHEN Lagebestimmung = 'unbekannt' THEN 5379 ---- 5379 unknown +WHEN Lagebestimmung = 'ungenau' THEN 5380 ---- 5380 inaccurate +END AS Lagebestimmung, +CASE WHEN Innenschutz = 'andere' THEN 5383 ---- 5383 other +WHEN Innenschutz = 'Anstrich_Beschichtung' THEN 248 ---- 248 coating +WHEN Innenschutz = 'Kanalklinkerauskleidung' THEN 250 ---- 250 brick_lining +WHEN Innenschutz = 'Steinzeugauskleidung' THEN 251 ---- 251 stoneware_lining +WHEN Innenschutz = 'unbekannt' THEN 5384 ---- 5384 unknown +WHEN Innenschutz = 'Zementmoertelauskleidung' THEN 249 ---- 249 cement_mortar_lining +END AS Innenschutz, laengeeffektiv, +CASE WHEN Material = 'andere' THEN 5381 ---- 5381 other +WHEN Material = 'Asbestzement' THEN 2754 ---- 2754 asbestos_cement +WHEN Material = 'Beton_Normalbeton' THEN 3638 ---- 3638 concrete_normal +WHEN Material = 'Beton_Ortsbeton' THEN 3639 ---- 3639 concrete_insitu +WHEN Material = 'Beton_Pressrohrbeton' THEN 3640 ---- 3640 concrete_presspipe +WHEN Material = 'Beton_Spezialbeton' THEN 3641 ---- 3641 concrete_special +WHEN Material = 'Beton_unbekannt' THEN 3256 ---- 3256 concrete_unknown +WHEN Material = 'Faserzement' THEN 147 ---- 147 fiber_cement +WHEN Material = 'Gebrannte_Steine' THEN 2755 ---- 2755 bricks +WHEN Material = 'Guss_duktil' THEN 148 ---- 148 cast_ductile_iron +WHEN Material = 'Guss_Grauguss' THEN 3648 ---- 3648 cast_gray_iron +WHEN Material = 'Kunststoff_Epoxydharz' THEN 5076 ---- 5076 plastic_epoxy_resin +WHEN Material = 'Kunststoff_Hartpolyethylen' THEN 5077 ---- 5077 plastic_highdensity_polyethylene +WHEN Material = 'Kunststoff_Polyester_GUP' THEN 5078 ---- 5078 plastic_polyester_GUP +WHEN Material = 'Kunststoff_Polyethylen' THEN 5079 ---- 5079 plastic_polyethylene +WHEN Material = 'Kunststoff_Polypropylen' THEN 5080 ---- 5080 plastic_polypropylene +WHEN Material = 'Kunststoff_Polyvinilchlorid' THEN 5081 ---- 5081 plastic_PVC +WHEN Material = 'Kunststoff_unbekannt' THEN 5382 ---- 5382 plastic_unknown +WHEN Material = 'Stahl' THEN 153 ---- 153 steel +WHEN Material = 'Stahl_rostfrei' THEN 3654 ---- 3654 steel_stainless +WHEN Material = 'Steinzeug' THEN 154 ---- 154 stoneware +WHEN Material = 'Ton' THEN 2761 ---- 2761 clay +WHEN Material = 'unbekannt' THEN 3016 ---- 3016 unknown +WHEN Material = 'Zement' THEN 2762 ---- 2762 cement +END AS Material, ST_Force3D(verlauf), +CASE WHEN Reliner_Material = 'andere' THEN 6459 ---- 6459 other +WHEN Reliner_Material = 'Epoxidharz_Glasfaserlaminat' THEN 6461 ---- 6461 epoxy_resin_glass_fibre_laminate +WHEN Reliner_Material = 'Epoxidharz_Kunststofffilz' THEN 6460 ---- 6460 epoxy_resin_plastic_felt +WHEN Reliner_Material = 'GUP_Rohr' THEN 6483 ---- 6483 GUP_pipe +WHEN Reliner_Material = 'HDPE' THEN 6462 ---- 6462 HDPE +WHEN Reliner_Material = 'Isocyanatharze_Glasfaserlaminat' THEN 6484 ---- 6484 isocyanate_resin_glass_fibre_laminate +WHEN Reliner_Material = 'Isocyanatharze_Kunststofffilz' THEN 6485 ---- 6485 isocyanate_resin_plastic_felt +WHEN Reliner_Material = 'Polyesterharz_Glasfaserlaminat' THEN 6464 ---- 6464 polyester_resin_glass_fibre_laminate +WHEN Reliner_Material = 'Polyesterharz_Kunststofffilz' THEN 6463 ---- 6463 polyester_resin_plastic_felt +WHEN Reliner_Material = 'Polypropylen' THEN 6482 ---- 6482 polypropylene +WHEN Reliner_Material = 'Polyvinilchlorid' THEN 6465 ---- 6465 PVC +WHEN Reliner_Material = 'Sohle_mit_Schale_aus_Polyesterbeton' THEN 6466 ---- 6466 bottom_with_polyester_concret_shell +WHEN Reliner_Material = 'unbekannt' THEN 6467 ---- 6467 unknown +WHEN Reliner_Material = 'UP_Harz_LED_Synthesefaserliner' THEN 6486 ---- 6486 UP_resin_LED_synthetic_fibre_liner +WHEN Reliner_Material = 'Vinylesterharz_Glasfaserlaminat' THEN 6468 ---- 6468 vinyl_ester_resin_glass_fibre_laminate +WHEN Reliner_Material = 'Vinylesterharz_Kunststofffilz' THEN 6469 ---- 6469 vinyl_ester_resin_plastic_felt +END AS Reliner_Material, reliner_nennweite, +CASE WHEN Reliner_Bautechnik = 'andere' THEN 6448 ---- 6448 other +WHEN Reliner_Bautechnik = 'Close_Fit_Relining' THEN 6479 ---- 6479 close_fit_relining +WHEN Reliner_Bautechnik = 'Kurzrohrrelining' THEN 6449 ---- 6449 relining_short_tube +WHEN Reliner_Bautechnik = 'Noppenschlauchrelining' THEN 6481 ---- 6481 grouted_in_place_lining +WHEN Reliner_Bautechnik = 'Partieller_Liner' THEN 6452 ---- 6452 partial_liner +WHEN Reliner_Bautechnik = 'Rohrstrangrelining' THEN 6450 ---- 6450 pipe_string_relining +WHEN Reliner_Bautechnik = 'Schlauchrelining' THEN 6451 ---- 6451 hose_relining +WHEN Reliner_Bautechnik = 'unbekannt' THEN 6453 ---- 6453 unknown +WHEN Reliner_Bautechnik = 'Wickelrohrrelining' THEN 6480 ---- 6480 spiral_lining +END AS Reliner_Bautechnik, +CASE WHEN Reliner_Art = 'ganze_Haltung' THEN 6455 ---- 6455 full_reach +WHEN Reliner_Art = 'partiell' THEN 6456 ---- 6456 partial +WHEN Reliner_Art = 'unbekannt' THEN 6457 ---- 6457 unknown +END AS Reliner_Art, ringsteifigkeit, plangefaelle, wandrauhigkeit, abwa_2015neu_3122.objid_lookup('Haltungspunkt', vonhaltungspunktref::int), abwa_2015neu_3122.objid_lookup('Haltungspunkt', nachhaltungspunktref::int), abwa_2015neu_3122.objid_lookup('Rohrprofil', rohrprofilref::int) +FROM abwa_2015neu_3122.Haltung + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Haltung.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.reach_text +( +obj_id, fk_reach, plantype, text, remark, textori, texthali, textvali, textpos_geometry, last_modification) +SELECT +-- abwa_2015neu_3122.objid_lookup('Haltung', Haltungref::int) as obj_id, +qgep_sys.generate_oid('qgep_od','txt_text'), + abwa_2015neu_3122.objid_lookup('Haltung', haltungref::int) as haltungref, +CASE WHEN a.Plantyp = 'Leitungskataster' THEN 7844 ---- 7844 pipeline_registry +WHEN a.Plantyp = 'Uebersichtsplan.UeP10' THEN 7846 ---- 7846 overviewmap.om10 +WHEN a.Plantyp = 'Uebersichtsplan.UeP2' THEN 7847 ---- 7847 overviewmap.om2 +WHEN a.Plantyp = 'Uebersichtsplan.UeP5' THEN 7848 ---- 7848 overviewmap.om5 +WHEN a.Plantyp = 'Werkplan' THEN 7845 ---- 7845 network_plan +END AS Plantyp, +a.textinhalt, a.bemerkung, +b.textori, +CASE WHEN b.textvali = 'TOP' THEN 0 +WHEN b.textvali = 'CAP' THEN 1 +WHEN b.textvali = 'HALF' THEN 2 +WHEN b.textvali = 'BASE' THEN 3 +END AS textvali, +CASE WHEN b.texthali = 'LEFT' THEN 0 +WHEN b.texthali = 'CENTER' THEN 1 +WHEN b.texthali = 'RIGHT' THEN 2 +END AS texthali, +--ST_FORCE3D(b.textpos), +b.textpos, +Letzte_Aenderung +FROM abwa_2015neu_3122.Haltung_text + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Haltung_text.t_id = vw_sia405_baseclass_metaattribute.t_id + LEFT JOIN abwa_2015neu_3122.sia405_textpos as a ON abwa_2015neu_3122.Haltung_text.t_id = a.t_id + LEFT JOIN abwa_2015neu_3122.textpos as b ON abwa_2015neu_3122.Haltung_text.t_id = b.t_id; + +INSERT INTO qgep_od.structure_part +( +obj_id, identifier, remark, renovation_demand, fk_wastewater_structure, last_modification, fk_dataowner, fk_provider) +SELECT obj_id, bezeichnung, bemerkung, +CASE WHEN Instandstellung = 'nicht_notwendig' THEN 138 ---- 138 not_necessary +WHEN Instandstellung = 'notwendig' THEN 137 ---- 137 necessary +WHEN Instandstellung = 'unbekannt' THEN 5358 ---- 5358 unknown +END AS Instandstellung, abwa_2015neu_3122.objid_lookup('Abwasserbauwerk', abwasserbauwerkref::int), Letzte_Aenderung, +--Datenherr, datenlieferant +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(Datenherr), +abwa_2015neu_3122.obj_id_identifer_organisation_lookup(datenlieferant) +FROM abwa_2015neu_3122.BauwerksTeil + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.BauwerksTeil.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.dryweather_downspout +( +obj_id, diameter) +SELECT obj_id, durchmesser +FROM abwa_2015neu_3122.Trockenwetterfallrohr + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Trockenwetterfallrohr.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.access_aid +( +obj_id, kind) +SELECT obj_id, +CASE WHEN Art = 'andere' THEN 5357 ---- 5357 other +WHEN Art = 'Drucktuere' THEN 243 ---- 243 pressurized_door +WHEN Art = 'keine' THEN 92 ---- 92 none +WHEN Art = 'Leiter' THEN 240 ---- 240 ladder +WHEN Art = 'Steigeisen' THEN 241 ---- 241 step_iron +WHEN Art = 'Treppe' THEN 3473 ---- 3473 staircase +WHEN Art = 'Trittnischen' THEN 91 ---- 91 footstep_niches +WHEN Art = 'Tuere' THEN 3230 ---- 3230 door +WHEN Art = 'unbekannt' THEN 3048 ---- 3048 unknown +END AS Art +FROM abwa_2015neu_3122.Einstiegshilfe + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Einstiegshilfe.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.dryweather_flume +( +obj_id, material) +SELECT obj_id, +CASE WHEN Material = 'andere' THEN 3221 ---- 3221 other +WHEN Material = 'kombiniert' THEN 354 ---- 354 combined +WHEN Material = 'Kunststoff' THEN 5356 ---- 5356 plastic +WHEN Material = 'Steinzeug' THEN 238 ---- 238 stoneware +WHEN Material = 'unbekannt' THEN 3017 ---- 3017 unknown +WHEN Material = 'Zementmoertel' THEN 237 ---- 237 cement_mortar +END AS Material +FROM abwa_2015neu_3122.Trockenwetterrinne + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Trockenwetterrinne.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.cover +( +obj_id, brand, cover_shape, diameter, fastening, level, material, positional_accuracy, situation_geometry, sludge_bucket, venting) +SELECT obj_id, fabrikat, +CASE WHEN Deckelform = 'andere' THEN 5353 ---- 5353 other +WHEN Deckelform = 'eckig' THEN 3499 ---- 3499 rectangular +WHEN Deckelform = 'rund' THEN 3498 ---- 3498 round +WHEN Deckelform = 'unbekannt' THEN 5354 ---- 5354 unknown +END AS Deckelform, durchmesser, +CASE WHEN Verschluss = 'nicht_verschraubt' THEN 5350 ---- 5350 not_bolted +WHEN Verschluss = 'unbekannt' THEN 5351 ---- 5351 unknown +WHEN Verschluss = 'verschraubt' THEN 5352 ---- 5352 bolted +END AS Verschluss, kote, +CASE WHEN Material = 'andere' THEN 5355 ---- 5355 other +WHEN Material = 'Beton' THEN 234 ---- 234 concrete +WHEN Material = 'Guss' THEN 233 ---- 233 cast_iron +WHEN Material = 'Guss_mit_Belagsfuellung' THEN 5547 ---- 5547 cast_iron_with_pavement_filling +WHEN Material = 'Guss_mit_Betonfuellung' THEN 235 ---- 235 cast_iron_with_concrete_filling +WHEN Material = 'unbekannt' THEN 3015 ---- 3015 unknown +END AS Material, +CASE WHEN Lagegenauigkeit = 'groesser_50cm' THEN 3243 ---- 3243 more_than_50cm +WHEN Lagegenauigkeit = 'plusminus_10cm' THEN 3241 ---- 3241 plusminus_10cm +WHEN Lagegenauigkeit = 'plusminus_3cm' THEN 3236 ---- 3236 plusminus_3cm +WHEN Lagegenauigkeit = 'plusminus_50cm' THEN 3242 ---- 3242 plusminus_50cm +WHEN Lagegenauigkeit = 'unbekannt' THEN 5349 ---- 5349 unknown +END AS Lagegenauigkeit, ST_Force3D(lage), +CASE WHEN Schlammeimer = 'nicht_vorhanden' THEN 423 ---- 423 inexistent +WHEN Schlammeimer = 'unbekannt' THEN 3066 ---- 3066 unknown +WHEN Schlammeimer = 'vorhanden' THEN 422 ---- 422 existent +END AS Schlammeimer, +CASE WHEN Entlueftung = 'entlueftet' THEN 229 ---- 229 vented +WHEN Entlueftung = 'nicht_entlueftet' THEN 230 ---- 230 not_vented +WHEN Entlueftung = 'unbekannt' THEN 5348 ---- 5348 unknown +END AS Entlueftung +FROM abwa_2015neu_3122.Deckel + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Deckel.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; + +INSERT INTO qgep_od.benching +( +obj_id, kind) +SELECT obj_id, +CASE WHEN Art = 'andere' THEN 5319 ---- 5319 other +WHEN Art = 'beidseitig' THEN 94 ---- 94 double_sided +WHEN Art = 'einseitig' THEN 93 ---- 93 one_sided +WHEN Art = 'kein' THEN 3231 ---- 3231 none +WHEN Art = 'unbekannt' THEN 3033 ---- 3033 unknown +END AS Art +FROM abwa_2015neu_3122.Bankett + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON abwa_2015neu_3122.Bankett.t_id = vw_sia405_baseclass_metaattribute.t_id +WHERE NOT obj_id isNull; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/abwa_2015neu_3122.vw_organisation.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/abwa_2015neu_3122.vw_organisation.sql new file mode 100644 index 00000000..17c37198 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/abwa_2015neu_3122.vw_organisation.sql @@ -0,0 +1,13 @@ +--View: abwa_2015neu_3122.vw_organisation +-- DROP VIEW IF EXISTS qgep.vw_organisation; +CREATE OR REPLACE VIEW abwa_2015neu_3122.vw_organisation AS + SELECT vw_sia405_baseclass_metaattribute.obj_id, + vw_sia405_baseclass_metaattribute.datenherr, + vw_sia405_baseclass_metaattribute.datenlieferant, + vw_sia405_baseclass_metaattribute.letzte_aenderung, + organisation.* + FROM abwa_2015neu_3122.organisation + LEFT JOIN abwa_2015neu_3122.vw_sia405_baseclass_metaattribute ON organisation.t_id::text = vw_sia405_baseclass_metaattribute.t_id::text; + +ALTER TABLE abwa_2015neu_3122.vw_organisation +OWNER TO postgres; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_abwasserknoten_xfach.png b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_abwasserknoten_xfach.png new file mode 100644 index 00000000..614a13a9 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_abwasserknoten_xfach.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_einleistelle_xfach.png b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_einleistelle_xfach.png new file mode 100644 index 00000000..55e90a30 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_einleistelle_xfach.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_normschacht_xfach.png b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_normschacht_xfach.png new file mode 100644 index 00000000..5a998a58 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/bezeichnung_normschacht_xfach.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/create_abwa_2015neu_3122.count_element_sia405_abwasser.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/create_abwa_2015neu_3122.count_element_sia405_abwasser.sql new file mode 100644 index 00000000..d08ad13b --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/create_abwa_2015neu_3122.count_element_sia405_abwasser.sql @@ -0,0 +1,83 @@ +-- function for counting number of object in tables (german classnames) +-- 13.7.2019 sjib +-- SELECT abwa_2015neu_3122.count_elements(); +CREATE OR REPLACE FUNCTION abwa_2015neu_3122.count_elements() + RETURNS text AS +$BODY$ +DECLARE + table_elements text; + list text; + +BEGIN + +list = 'List of elements in tables: '; +list = list || 'organisation: '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.organisation; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk (wastewater_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.abwasserbauwerk; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk_text (wastewater_structure_text): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.abwasserbauwerk_text; +list = list || table_elements || ', '; +list = list || 'abwasserbauwerk_symbol (wastewater_structure_symbol): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.abwasserbauwerk_symbol; +list = list || table_elements || ', '; +list = list || 'kanal (channel): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.kanal; +list = list || table_elements || ', '; +list = list || 'nomschacht (manhole): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.normschacht; +list = list || table_elements || ', '; +list = list || 'einleitstelle (discharge_point): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.einleitstelle; +list = list || table_elements || ', '; +list = list || 'spezialbauwerk (special_structure): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.spezialbauwerk; +list = list || table_elements || ', '; +list = list || 'versickerungsanlage (infiltration_installation): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.versickerungsanlage; +list = list || table_elements || ', '; +list = list || 'rohrprofil (pipe_profile): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.rohrprofil; +list = list || table_elements || ', '; +list = list || 'abwassernetzelement (wastewater_networkelement): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.abwassernetzelement; +list = list || table_elements || ', '; +list = list || 'haltungspunkt (reach_point): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.haltungspunkt; +list = list || table_elements || ', '; +list = list || 'abwasserknoten (wastewater_node): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.abwasserknoten; +list = list || table_elements || ', '; +list = list || 'haltung (reach): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.haltung; +list = list || table_elements || ', '; +list = list || 'haltung_text (reach_text): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.haltung_text; +list = list || table_elements || ', '; +list = list || 'bauwerksteil (structure_part): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.bauwerksteil; +list = list || table_elements || ', '; +list = list || 'trockenwetterfallrohr (dryweather_downspout): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.trockenwetterfallrohr; +list = list || table_elements || ', '; +list = list || 'einstiegshilfe (access_aid): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.einstiegshilfe; +list = list || table_elements || ', '; +list = list || 'trockenwetterrinne (dryweather_flume): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.trockenwetterrinne; +list = list || table_elements || ', '; +list = list || 'deckel (cover): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.deckel; +list = list || table_elements || ', '; +list = list || 'bankett (benching): '; +SELECT COUNT(t_id) INTO table_elements FROM abwa_2015neu_3122.bankett; +list = list || table_elements || ', '; + +RETURN list; + +END; +$BODY$ + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/create_qgep_od.count_element_sia405_abwasser.sql b/docs/stefans_scripts/import/sia405_abwasser_2015/create_qgep_od.count_element_sia405_abwasser.sql new file mode 100644 index 00000000..f7be53bb --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/create_qgep_od.count_element_sia405_abwasser.sql @@ -0,0 +1,111 @@ +-- function for counting number of object in tables +-- 13.7.2019 sjib +-- SELECT qgep_od.count_elements(); +CREATE OR REPLACE FUNCTION qgep_od.count_elements() + RETURNS text AS +$BODY$ +DECLARE + table_elements integer; + list text; + check_structure_parts integer; + structure_parts integer; + +BEGIN + +list = 'List of elements in tables: '; +list = list || 'organisation: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.organisation; +list = list || table_elements || ', '; +list = list || 'wastewater_structure: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.wastewater_structure; +list = list || table_elements || ', '; +list = list || 'wastewater_structure_text: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.wastewater_structure_text; +list = list || table_elements || ', '; +list = list || 'wastewater_structure_symbol: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.wastewater_structure_symbol; +list = list || table_elements || ', '; +list = list || 'channel: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.channel; +list = list || table_elements || ', '; +list = list || 'manhole: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.manhole; +list = list || table_elements || ', '; +list = list || 'discharge_point: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.discharge_point; +list = list || table_elements || ', '; +list = list || 'special_structure: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.special_structure; +list = list || table_elements || ', '; +list = list || 'infiltration_installation: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.infiltration_installation; +list = list || table_elements || ', '; +list = list || 'pipe_profile: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.pipe_profile; +list = list || table_elements || ', '; +list = list || 'wastewater_networkelement: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.wastewater_networkelement; +list = list || table_elements || ', '; +list = list || 'reach_point: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.reach_point; +list = list || table_elements || ', '; +list = list || 'wastewater_node: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.wastewater_node; +list = list || table_elements || ', '; +list = list || 'reach: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.reach; +list = list || table_elements || ', '; +list = list || 'reach_text: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.reach_text; +list = list || table_elements || ', '; +list = list || 'structure_part: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.structure_part; + +structure_parts = table_elements::integer; +check_structure_parts = structure_parts; + +list = list || table_elements || ', '; +list = list || 'dryweather_downspout: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.dryweather_downspout; +list = list || table_elements || ', '; + +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'access_aid: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.access_aid; +list = list || table_elements || ', '; + +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'dryweather_flume: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.dryweather_flume; +list = list || table_elements || ', '; + +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'cover: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.cover; +list = list || table_elements || ', '; + +check_structure_parts = check_structure_parts - table_elements::integer; + +list = list || 'benching: '; +SELECT COUNT(obj_id) INTO table_elements FROM qgep_od.benching; +list = list || table_elements || ', '; + +check_structure_parts = check_structure_parts - table_elements::integer; + +IF check_structure_parts <> 0 THEN + list = list || 'number of subclass of structure parts not correct: checksum = ' || check_structure_parts; +ELSE + list = list || ' - number of subclass elements of structure parts OK!'; +END IF; + + +RETURN list; + +END; +$BODY$ + -- 3.2.2017 geändert LANGUAGE plpgsql STABLE + LANGUAGE plpgsql VOLATILE + COST 100; diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/i0_createschema_sia405_abwasser_2015_2_d.bat b/docs/stefans_scripts/import/sia405_abwasser_2015/i0_createschema_sia405_abwasser_2015_2_d.bat new file mode 100644 index 00000000..52a3bafb --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/i0_createschema_sia405_abwasser_2015_2_d.bat @@ -0,0 +1,8 @@ +rem pause +rem --defaultSrsAuth EPSG --defaultSrsCode 2056 ergänzt 12.7.2019 + + +rem set variable to ili2pg*.jar, dbdatabase, dbpwd, ilipath, xtf path etc. + +java -jar ../ili2pg-3.12.2.jar --createEnumTxtCol --schemaimport --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --defaultSrsAuth EPSG --defaultSrsCode 2056 --dbhost localhost --dbport 5432 --dbdatabase qgep_gruner --dbschema abwa_2015neu_3122 --dbusr postgres --dbpwd sjib --log createschema_sia405_abwasser_2015_2.log --trace SIA405_Abwasser_2015_2_d-20180417.ili +pause diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/i1_importdaten_sia405_abwasser_2015_2_d_3122_hofstetten.bat b/docs/stefans_scripts/import/sia405_abwasser_2015/i1_importdaten_sia405_abwasser_2015_2_d_3122_hofstetten.bat new file mode 100644 index 00000000..2c25a4ab --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/i1_importdaten_sia405_abwasser_2015_2_d_3122_hofstetten.bat @@ -0,0 +1,11 @@ +rem pause +rem --defaultSrsAuth EPSG --defaultSrsCode 2056 ergänzt 12.7.2019 + + +rem set variable to ili2pg*.jar, dbdatabase, dbpwd, ilipath, xtf path etc. + +java -jar ../ili2pg-3.12.2.jar --createEnumTxtCol --import --deleteData --importTid --sqlEnableNull --createEnumTabs --createFk --noSmartMapping --defaultSrsAuth EPSG --defaultSrsCode 2056 --dbhost localhost --dbport 5432 --dbdatabase qgep_gruner --dbschema abwa_2015neu_3122 --dbusr postgres --dbpwd sjib --log importdaten_hof_3122.log --trace SIA405_Abwasser_2015_GemeindeHofstettenFlueh.xtf +pause + + +rem SIA405_Abwasser_2015_ALT_GemeindeBuesserach_LV95.xtf diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/i2_importschema_anpassungen_sia405_abwasser_2015_2_d.bat b/docs/stefans_scripts/import/sia405_abwasser_2015/i2_importschema_anpassungen_sia405_abwasser_2015_2_d.bat new file mode 100644 index 00000000..9f5530e7 --- /dev/null +++ b/docs/stefans_scripts/import/sia405_abwasser_2015/i2_importschema_anpassungen_sia405_abwasser_2015_2_d.bat @@ -0,0 +1,37 @@ +set db=qgep_gruner +set port=5432 +rem set PATH=%PATH%;C:\Program Files\PostgreSQL\9.6\bin +set PATH=%PATH%;C:\Program Files\PostgreSQL\12\bin + +rem db erzeugen +rem createdb -U postgres -p %port% %db% +psql -U postgres -h localhost -p %port% -d %db% -f 01_abwa_2015neu_3122_tid_generate.sql> 01_tid_generate.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 02_abwa_2015neu_3122_identifier_lookup.sql> 02_identifier_lookup.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 02_abwa_2015neu_3122_objid_lookup.sql> 02_objid_lookup.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 02_abwa_2015neu_3122_tid_lookup.sql> 02_tid_lookup.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 046_abwa_2015neu_3122_t_key_object_insert_metadata.sql> 046_t_key_object_insert_metadata.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 050_abwa_2015neu_3122_import_vw_sia405_baseclass_metattribute.sql> 050_vw_sia405_baseclass_metattribute.log 2>&1 +PAUSE + +-- rem neu 12.7.2019 +psql -U postgres -h localhost -p %port% -d %db% -f abwa_2015neu_3122.vw_organisation.sql> abwa_2015neu_3122.vw_organisation.log 2>&1 +PAUSE + + +psql -U postgres -h localhost -p %port% -d %db% -f 053_create_key_object_seq.sql> 053_create_key_object_seq.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 054_create_function_meta_organisation_ohne_subclass_20190711.sql> 054_create_function_meta_organisation_ohne_subclass_20190711.log 2>&1 +PAUSE + +psql -U postgres -h localhost -p %port% -d %db% -f 055_select_meta_organisation_bezeichnung_obj_id_flue.sql> 055_select_meta_organisation_bezeichnung_obj_id.log 2>&1 diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids.png b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids.png new file mode 100644 index 00000000..a0addf55 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids2.png b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids2.png new file mode 100644 index 00000000..43b8d8cb Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids2.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids3.png b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids3.png new file mode 100644 index 00000000..cc908e63 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/organisation_neue_obj_ids3.png differ diff --git a/docs/stefans_scripts/import/sia405_abwasser_2015/xtf_hof_fehlende_obj_id_organisation.png b/docs/stefans_scripts/import/sia405_abwasser_2015/xtf_hof_fehlende_obj_id_organisation.png new file mode 100644 index 00000000..fdc49700 Binary files /dev/null and b/docs/stefans_scripts/import/sia405_abwasser_2015/xtf_hof_fehlende_obj_id_organisation.png differ diff --git a/docs/stefans_scripts/uml_sia405_eaux.jpg b/docs/stefans_scripts/uml_sia405_eaux.jpg new file mode 100644 index 00000000..b705b0e2 Binary files /dev/null and b/docs/stefans_scripts/uml_sia405_eaux.jpg differ diff --git a/docs/stefans_scripts/uml_sia405_wasser.jpg b/docs/stefans_scripts/uml_sia405_wasser.jpg new file mode 100644 index 00000000..26238a0d Binary files /dev/null and b/docs/stefans_scripts/uml_sia405_wasser.jpg differ