Giter Club home page Giter Club logo

district_heating's Introduction

TEKSI District Heating Module

Here will come future district heating module

district_heating's People

Contributors

sjib avatar ponceta avatar pre-commit-ci[bot] avatar jpdupuy avatar

Watchers

Denis Rouzaud avatar  avatar  avatar Damiano Lombardi avatar

district_heating's Issues

Get latest datamodel dump and install tdh data model

You can check out the latest datamodel dump from this page:
https://github.com/teksi/district_heating/actions/workflows/datamodel-create-dumps.yml

20240810_checkout_database_dump_tdh

Select the latest version from the Artifacts:
20240810_checkout_database_dump_tdh_2

Download datamodel-dumps.zip

20240810_tdh_restore_backup

Use the tdh_dev_structure_and_demo_data.backup out of this zip file to restore with pgAdmin

note:
If your restore fails with: pg_restore: error: could not execute query: FEHLER: Rolle »tdh_viewer« existiert nicht
create the roles first:
https://github.com/teksi/district_heating/blob/main/datamodel/12_0_roles.sql (for database cluster) -> download as raw
https://github.com/teksi/district_heating/blob/main/datamodel/12_1_roles.sql (for database) -> download as raw

20240810_download_12_1_roles sql

20240810_query_tools_create_roles

Support several geometry types for lines (pipe_section, cables) and for polygons (structure, trench)

The current defintion prevents FME to import geopackage data id the geometry constraint is based on a unique geometry type
ALTER TABLE tdh_od.pipe_section ADD COLUMN geometry3d_geometry geometry('COMPOUNDCURVEZ', :SRID);
ALTER TABLE tdh_od.structure ADD COLUMN geometry3d_geometry geometry('CURVEPOLYGONZ', :SRID);

Whenever the geopackage is made of strait lines (Linestring) or strait lines + arcs (compoundcurve) fme stops with a fatal error :
ERROR |Bulk copy failed on table 'tdh_od.pipe_section' using delimiter ':'. Error was 'ERROR: Geometry type (LineString) does not match column type (CompoundCurve)
CONTEXT: COPY pipe_section, line 1, column geometry3d_geometry: "01020000A008080000030000009AB114071E4843411E47ECD42A8F31...'
ERROR |POSTGIS writer: An error has occurred. Check the logfile above for details

I could not find a solution to solve this issue (The ArcStrocker would transform arcs into line segments, but you would have to change the constraint to a LINESTRINGZ in the datamodel).

I suggest to add the following constraints
ALTER TABLE tdh_od.pipe_section ADD COLUMN geometry3d_geometry geometry('GEOMETRYZ', :SRID);
ALTER TABLE tdh_od.pipe_section ADD CONSTRAINT enforce_pipe_section_geotype_geometry3d
CHECK (geometrytype(geometry3d_geometry) = 'LINESTRING'::TEXT OR geometrytype(geometry3d_geometry) = 'COMPOUNDCURVE'::TEXT
OR geometrytype(geometry3d_geometry) = 'LINESTRINGZ'::TEXT OR geometrytype(geometry3d_geometry) = 'COMPOUNDCURVEZ'::TEXT);

ALTER TABLE tdh_od.sia405cc_cable ADD COLUMN geometry3d_geometry geometry('GEOMETRYZ', :SRID);
ALTER TABLE tdh_od.sia405cc_cable ADD CONSTRAINT enforce_cable_geotype_geometry3d
CHECK (geometrytype(geometry3d_geometry) = 'LINESTRING'::TEXT OR geometrytype(geometry3d_geometry) = 'COMPOUNDCURVE'::TEXT
OR geometrytype(geometry3d_geometry) = 'LINESTRINGZ'::TEXT OR geometrytype(geometry3d_geometry) = 'COMPOUNDCURVEZ'::TEXT);

ALTER TABLE tdh_od.structure ADD COLUMN geometry3d_geometry geometry('GEOMETRYZ', :SRID);
ALTER TABLE tdh_od.structure ADD CONSTRAINT enforce_structure_geotype_geometry3d
CHECK (geometrytype(geometry3d_geometry) = 'POLYGON'::TEXT OR geometrytype(geometry3d_geometry) = 'CURVEPOLYGON'::TEXT
OR geometrytype(geometry3d_geometry) = 'POLYGONZ'::TEXT OR geometrytype(geometry3d_geometry) = 'CURVEPOLYGONZ'::TEXT);
Please find a zip file to reproduce the error
fme_scripts.zip

Classes supported for first version

I have reviewed the classes of the official model and I can confirm :

  • Ouvrage (surface)
  • Tracé (line)
  • Point du tracé (point)
  • Conduite (line)
  • Point de conduite (point)(normal et alimentation)
  • Cable (line)
  • Point de cable (point)

Status valeurs

INSERT INTO tdh_vl.pipe_section_status (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (8012,8012,'operational.operational','in_Betrieb.in_Betrieb','en_service.en_service', 'in_funzione.in_funzione', 'functionala.functionala', '', '', '', '', '', 'true');

INSERT INTO tdh_vl.structure_status (code, vsacode, value_en, value_de, value_fr, value_it, value_ro, abbr_en, abbr_de, abbr_fr, abbr_it, abbr_ro, active) VALUES (8209,8209,'inoperative.inoperative','ausser_Betrieb.ausser_Betrieb','hors_service.hors_service', 'fuori_servizio.fuori_servizio', 'rrr_ausser_Betrieb.ausser_Betrieb', '', '', '', '', '', 'true');

no subvalues for these values in INTERLIS

Modelling of geometries - one or several? 2D/3D?

The SIA405 Fernwaerme Model is modelling geometries Surface and Ligne of OUVRAGE and TRACE with an extra class:

CLASS Ouvrage_Surface =
ATTRIBUTE
!!   Geometrie: MANDATORY SURFACE WITH (STRAIGHTS, ARCS) VERTEX Base_f_LV95.CoordNat
!!              WITHOUT OVERLAPS > 0.050;
   Geometrie: MANDATORY Base_f.Surface;
END Ouvrage_Surface;

ASSOCIATION Ouvrage_SurfaceAssoc =
   OuvrageRef  -<#> {1} Ouvrage;
   Surface --   {0 .. *} Ouvrage_Surface;
END Ouvrage_SurfaceAssoc;

CLASS Ouvrage_Ligne =
ATTRIBUTE
    Geometrie: MANDATORY Base_f.Polyligne;
END Ouvrage_Ligne;

ASSOCIATION Ouvrage_LigneAssoc =
   OuvrageRef  -<#> {1} Ouvrage;
   Ligne --   {0 .. *} Ouvrage_Ligne;
END Ouvrage_LigneAssoc;

Tthis would allow to have several surfaces and lines for the classes OUVRAGE / TRACE. This would allow to have an e.g. inner and outer surface and if needed lines for drawing details.

Should this be supported in this first version of the module?

We could also just start with one each and see if this is enough during the discussion of your prototype.

Do you want support for 3D geometry?

Currently geomtries are modelled like this:
2D

ALTER TABLE tdh_od.structure ADD COLUMN geometry_geometry geometry('CURVEPOLYGON', :SRID);
CREATE INDEX in_tdh_structure_geometry_geometry ON tdh_od.structure USING gist (geometry_geometry );
COMMENT ON COLUMN tdh_od.structure.geometry_geometry IS ' / offener oder geschlossener Linienzug, Stützpunkte in Landeskoordinaten / polyligne ouverte ou fermée avec des points d’appui en coordonnées nationales';

3D

ALTER TABLE tdh_od.structure ADD COLUMN geometry3d_geometry geometry('CURVEPOLYGONZ', :SRID);
CREATE INDEX in_tdh_structure_geometry3d_geometry ON tdh_od.structure USING gist (geometry3d_geometry );
COMMENT ON COLUMN tdh_od.structure.geometry3d_geometry IS 'yyyy_geschlossener Linienzug, Stützpunkte in Landeskoordinaten / geschlossener Linienzug, Stützpunkte in Landeskoordinaten / polyligne fermée avec points d’appui en coordonnées nationales';

In TEKSI Wastewater we have changed to 3D

QGIS - forms character set

The attribut comment (mouse over) in QGIS does not seem to be correctly taken into account for special character (é, à, ä, ...)
QGIS_forms_character_set

owner - relation to class organisation needed

In SIA405 Fernwärme Attributes as owner are defined as text attributes:

Eigentuemer: SIA405_Base_LV95.OrganisationBezeichnung;

It is suggested to create relations to the class organisation instead in TEKSI Distance heating.

value list pipe_point_normal_kind : set inactiv values

Since Troncon_statique and troncon_hydraulique (nor noeud_statique and noeud_hydraulique) are not part of the first version, i believe that the value lists should set to inactive the related values armatures.point_statique. (ie: from 8136 to 8146)

QGIS_pipe_point_normal_kind

Table to import points from ground survey

It would be nice to improve the data model in order to import the points (XYZ and codes (ie classe + few attributes) and capture date) in the tdh_od database.

The QGIS operator could then easily snap to the imported points to create object in the classes (structure, pipe_section, pipe_point, cable, cable_point, trench, trench_point)

name_number - set MANDATORY?

Name_Nummer (name_number) – in INTERLIS not MANDATORY – how to handle in TEKSI Distance heating?
I would suggest to set it MANDATORY

Migration importing data in pipe_point and subclasses

@jpdupuy
Here the code as discussed for your migration:

--- Add additional DEREFERABLE constraints to data model

20240527_oorel_od_pipe_point_feed_pipe_point

ALTER TABLE tdh_od.pipe_point_feed ALTER CONSTRAINT oorel_od_pipe_point_feed_pipe_point DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE tdh_od.pipe_point_norma ALTER CONSTRAINT oorel_od_pipe_point_norma_pipe_point DEFERRABLE INITIALLY DEFERRED;

And maybe add in FME this call before the whole import or do it manually before running the import:
SET CONSTRAINTS ALL DEFERRED;

and then set back at the end

QGIS generates 2 distinct tables for 2D and 3D

Whenever the data model includes 2 geometry columns (ie for 2D and for 3D) for a specific table :
ALTER TABLE tdh_od.structure ADD COLUMN geometry_geometry geometry('CURVEPOLYGON', :SRID);
ALTER TABLE tdh_od.structure ADD COLUMN geometry3d_geometry geometry('CURVEPOLYGONZ', :SRID);
the QGIS Data manager will propose 2 tables with the same name to import in the canvas
image

Therefor, only one geometry column should be specified in the datamodel to avoid confusion (to be discussed)

SVG symbol library for District Heating

@sjib Do you know if the SVG symbol library has been published (refer to the SIA-405 cahier technique 2015)
If yes, can you please send it to me. It will help me to prepare the QGIS project file
I shall verify if this recommendation is made in the Development Guidelines.

QGIS : cannot add pipe_point

Impossible de valider les changements pour la couche point de conduite

Erreurs : ERROR: 1 feature(s) not added.

Erreur du fournisseur de données :
Erreur PostGIS lors de l'ajout d'entité : ERROR: relation "tdh_sys.dictionary_od_table" does not exist
LINE 1: ...ELECT shortcut_en FROM tdh_sys.di...
^
QUERY: SELECT shortcut_en FROM tdh_sys.dictionary_od_table WHERE tablename = table_name
CONTEXT: PL/pgSQL function tdh_sys.generate_oid(text,text) line 22 at SQL statement

setup.cmd for windows environment

Please note that we work in a windows environment and I had to copy the setup.sh (for linux environment) to setup.cmd.
I do not know if this environment must be taken into account for TEKSI users according to the product strategy.
If not, this would be an advantage.

Originally posted by @sjib in #1 (comment)

Add datamodel tests

Add or adapt the following tests datamodel\tests

  • test_on_delete.py (add)
  • test_geometry.py (adapt)
  • test_removed_fields.py (add)
  • test_schemas.py (check)
  • test_symbology.py (add)
  • test_triggers.py (add)
  • test_typos.py (add if needed)
  • test_views.py (add)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.