Skip to content

Commit

Permalink
#884 update routing centreline id
Browse files Browse the repository at this point in the history
  • Loading branch information
chmnata authored and radumas committed Apr 22, 2024
1 parent 8157142 commit c51cf0b
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions gis/centreline/sql/create_view_routing_centreline_directional.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
CREATE OR REPLACE VIEW gis_core.routing_centreline_directional AS

SELECT
centreline.centreline_id,
concat(centreline.centreline_id, 0)::integer AS id,
centreline.from_intersection_id AS source,
centreline.to_intersection_id AS target,
centreline.shape_length AS cost,
centreline.geom
FROM gis_core.centreline_latest AS centreline

UNION

SELECT
centreline.centreline_id,
concat(centreline.centreline_id, 1)::integer AS id,
centreline.to_intersection_id AS source,
centreline.from_intersection_id AS target,
centreline.shape_length AS cost,
st_reverse(centreline.geom) AS geom
FROM gis_core.centreline_latest AS centreline
WHERE centreline.oneway_dir_code = 0;
SELECT
centreline_id,
row_number() OVER () AS id,
source,
target,
cost,
geom

FROM (
SELECT
centreline.centreline_id,
centreline.from_intersection_id AS source,
centreline.to_intersection_id AS target,
centreline.shape_length AS cost,
centreline.geom
FROM gis_core.centreline_latest AS centreline

UNION

SELECT
centreline.centreline_id,
centreline.to_intersection_id AS source,
centreline.from_intersection_id AS target,
centreline.shape_length AS cost,
st_reverse(centreline.geom) AS geom
FROM gis_core.centreline_latest AS centreline
WHERE centreline.oneway_dir_code = 0) AS dup;

ALTER TABLE gis_core.routing_centreline_directional OWNER TO gis_admins;

Expand Down

0 comments on commit c51cf0b

Please sign in to comment.