From fc7f9aa457a25499a443b60a5daab4fa801409f5 Mon Sep 17 00:00:00 2001 From: Robbendebiene Date: Wed, 15 Nov 2023 13:32:19 +0100 Subject: [PATCH] Add stop area place ref to entrance ref --- pipeline/stop_places/sql/stop_places.sql | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pipeline/stop_places/sql/stop_places.sql b/pipeline/stop_places/sql/stop_places.sql index 8af9184..429c9d5 100644 --- a/pipeline/stop_places/sql/stop_places.sql +++ b/pipeline/stop_places/sql/stop_places.sql @@ -215,20 +215,26 @@ LANGUAGE SQL IMMUTABLE STRICT; * Creates the From and To element based on given ids * Returns null when any argument is null */ -CREATE OR REPLACE FUNCTION ex_FromTo(edge EDGE_DESCRIPTION) RETURNS xml AS +CREATE OR REPLACE FUNCTION ex_FromTo(area_id TEXT, edge EDGE_DESCRIPTION) RETURNS xml AS $$ SELECT xmlconcat( xmlelement(name "From", (SELECT CASE WHEN edge.fromType = 'ENTRANCE'::category - THEN xmlelement(name "EntranceRef", xmlattributes(edge.fromIFOPT AS "ref", 'any' AS "version")) + THEN xmlconcat( + xmlelement(name "PlaceRef", xmlattributes(area_id AS "ref", 'any' AS "version")), + xmlelement(name "EntranceRef", xmlattributes(edge.fromIFOPT AS "ref", 'any' AS "version")) + ) ELSE xmlelement(name "PlaceRef", xmlattributes(edge.fromIFOPT AS "ref", 'any' AS "version")) END) ), xmlelement(name "To", (SELECT CASE WHEN edge.toType = 'ENTRANCE'::category - THEN xmlelement(name "EntranceRef", xmlattributes(edge.toIFOPT AS "ref", 'any' AS "version")) + THEN xmlconcat( + xmlelement(name "PlaceRef", xmlattributes(area_id AS "ref", 'any' AS "version")), + xmlelement(name "EntranceRef", xmlattributes(edge.toIFOPT AS "ref", 'any' AS "version")) + ) ELSE xmlelement(name "PlaceRef", xmlattributes(edge.toIFOPT AS "ref", 'any' AS "version")) END) ) @@ -1433,7 +1439,7 @@ CREATE OR REPLACE VIEW xml_stopPlaces AS ( -- ex_LineString(ex.geom, ex.id), -- - ex_FromTo(ex.edge), + ex_FromTo(ex.area_id, ex.edge), -- ex_NumberOfSteps(ex.tags), --