generated from teksi/template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from teksi/2024-08-07-adapt-tww_app.vw_change…
…_points 2024-08-07-adapt-tww_app.vw_change_points
- Loading branch information
Showing
1 changed file
with
17 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |