Skip to content

Commit

Permalink
Add stop area place ref to entrance ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbendebiene committed Nov 15, 2023
1 parent f3b29df commit fc7f9aa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pipeline/stop_places/sql/stop_places.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down Expand Up @@ -1433,7 +1439,7 @@ CREATE OR REPLACE VIEW xml_stopPlaces AS (
-- <LineString>
ex_LineString(ex.geom, ex.id),
-- <From> <To>
ex_FromTo(ex.edge),
ex_FromTo(ex.area_id, ex.edge),
-- <NumberOfSteps>
ex_NumberOfSteps(ex.tags),
-- <AccessFeatureType>
Expand Down

0 comments on commit fc7f9aa

Please sign in to comment.