-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
CREATE OR REPLACE FUNCTION gis_core.get_centreline_btwn_intersections( | ||
_node_start integer, | ||
_node_end integer, | ||
OUT _node_start_out integer, | ||
OUT _node_end integer, | ||
OUT links text[], | ||
Check failure on line 6 in gis/centreline/sql/create_function_get_centreline_btwn_intersections.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
OUT geom geometry) | ||
Check failure on line 7 in gis/centreline/sql/create_function_get_centreline_btwn_intersections.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
RETURNS record | ||
LANGUAGE 'sql' | ||
COST 100 | ||
STABLE STRICT PARALLEL UNSAFE | ||
AS $BODY$ | ||
WITH results as ( | ||
SELECT * | ||
FROM pgr_dijkstra('SELECT id, source::int, target::int, cost::int | ||
as cost from gis_core.routing_centreline_directional', _node_start, _node_end) | ||
) | ||
|
||
SELECT _node_start, _node_end, array_agg(centreline_id), ST_union(ST_linemerge(geom)) as geom | ||
from results | ||
inner join gis_core.routing_centreline_directional on edge=id | ||
|
||
$BODY$; | ||
|
||
ALTER FUNCTION gis_core.get_centreline_btwn_intersections(integer, integer) | ||
OWNER TO gis_admins; | ||
|
||
COMMENT ON FUNCTION gis_core.get_centreline_btwn_intersections(integer, integer) | ||
IS 'Routing function for centreline, takes in start intersection_id and end intersection_id and returns an array of centreline_id, as well as one line geometry between two intersections.'; | ||
Check failure on line 29 in gis/centreline/sql/create_function_get_centreline_btwn_intersections.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
|
||
GRANT EXECUTE ON FUNCTION gis_core.get_centreline_btwn_intersections(integer, integer) TO bdit_humans; | ||
|
||
GRANT EXECUTE ON FUNCTION gis_core.get_centreline_btwn_intersections(integer, integer) TO gis_admins; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 centreline | ||
Check failure on line 10 in gis/centreline/sql/create_view_routing_centreline_directional.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
|
||
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 centreline | ||
Check failure on line 21 in gis/centreline/sql/create_view_routing_centreline_directional.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
WHERE centreline.oneway_dir_code = 0; | ||
|
||
ALTER TABLE gis_core.routing_centreline_directional | ||
OWNER TO gis_admins; | ||
|
||
COMMENT ON VIEW gis_core.routing_centreline_directional | ||
IS 'A view that contains centreline streets for routing, with duplicated rows for two-way streets and flipped geometries when necessary. A new id has been assigned to each centreline to distinguish duplicated lines.'; | ||
Check failure on line 28 in gis/centreline/sql/create_view_routing_centreline_directional.sql GitHub Actions / SQLFluff LintSQLFluff
|
||
|
||
GRANT SELECT ON TABLE gis_core.routing_centreline_directional TO bdit_humans; | ||
GRANT ALL ON TABLE gis_core.routing_centreline_directional TO gis_admins; | ||
|
||
|
||
|