Skip to content

Commit

Permalink
Merge pull request #366 from teksi/2024-08-07-adapt-tww_app.vw_change…
Browse files Browse the repository at this point in the history
…_points

2024-08-07-adapt-tww_app.vw_change_points
  • Loading branch information
ponceta authored Aug 28, 2024
2 parents 0c1c42c + d52a8e3 commit 4084a86
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions datamodel/app/view/vw_change_points.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
CREATE VIEW tww_app.vw_change_points AS
SELECT
rp_to.obj_id,
rp_to.situation3d_geometry::geometry(POINTZ, {SRID}) AS geom,
re.material <> re_next.material AS change_in_material,
re.clear_height <> re_next.clear_height AS change_in_clear_height,
(rp_from.level - rp_to.level) / re.length_effective - (rp_next_from.level - rp_next_to.level) / re_next.length_effective AS change_in_slope
CREATE OR REPLACE VIEW tww_app.vw_change_points
AS
SELECT ne_node.obj_id,
wn.situation3d_geometry AS geom,
re.material <> re_next.material AS change_in_material,
re.clear_height <> re_next.clear_height AS change_in_clear_height,
(rp_from.level - rp_to.level) / re.length_effective - (rp_next_from.level - rp_next_to.level) / re_next.length_effective AS change_in_slope
FROM tww_od.reach re
LEFT JOIN tww_od.reach_point rp_to ON rp_to.obj_id = re.fk_reach_point_to
LEFT JOIN tww_od.reach_point rp_from ON rp_from.obj_id = re.fk_reach_point_from
LEFT JOIN tww_od.reach re_next ON rp_to.fk_wastewater_networkelement = re_next.obj_id
LEFT JOIN tww_od.reach_point rp_next_to ON rp_next_to.obj_id = re_next.fk_reach_point_to
LEFT JOIN tww_od.reach_point rp_next_from ON rp_next_from.obj_id = re_next.fk_reach_point_from
LEFT JOIN tww_od.wastewater_networkelement ne ON re.obj_id = ne.obj_id
LEFT JOIN tww_od.wastewater_networkelement ne_next ON re_next.obj_id = ne_next.obj_id
WHERE ne_next.fk_wastewater_structure = ne.fk_wastewater_structure
LEFT JOIN tww_od.reach_point rp_to ON rp_to.obj_id::text = re.fk_reach_point_to::text
LEFT JOIN tww_od.reach_point rp_from ON rp_from.obj_id::text = re.fk_reach_point_from::text
LEFT JOIN tww_od.wastewater_networkelement ne_node ON ne_node.obj_id::text = rp_to.fk_wastewater_networkelement::text
LEFT JOIN tww_od.wastewater_node wn ON wn.obj_id::text = ne_node.obj_id::text
LEFT JOIN tww_od.reach_point rp_next_from ON rp_next_from.fk_wastewater_networkelement::text = ne_node.obj_id::text
LEFT JOIN tww_od.reach re_next ON rp_next_from.obj_id::text = re_next.fk_reach_point_from::text
LEFT JOIN tww_od.reach_point rp_next_to ON rp_next_to.obj_id::text = re_next.fk_reach_point_to::text
LEFT JOIN tww_od.wastewater_networkelement ne ON re.obj_id::text = ne.obj_id::text
LEFT JOIN tww_od.wastewater_networkelement ne_next ON re_next.obj_id::text = ne_next.obj_id::text
WHERE ne_next.fk_wastewater_structure::text = ne.fk_wastewater_structure::text;

0 comments on commit 4084a86

Please sign in to comment.