You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE INDEX infrastructure_link_external_source_link_id_idx ON infrastructure_network.infrastructure_link USING btree (external_link_source, external_link_id);
136
+
END IF;
137
+
END $$;
138
+
139
+
DO $$
140
+
BEGIN
141
+
IF to_regclass('infrastructure_network.vehicle_submode_on_infrastructure_link') IS NULL THEN
ALTER TABLE ONLY infrastructure_network.vehicle_submode_on_infrastructure_link
151
+
ADD CONSTRAINT vehicle_submode_on_infrastructure_link_infrastructure_link_id_f FOREIGN KEY (infrastructure_link_id) REFERENCES infrastructure_network.infrastructure_link(infrastructure_link_id) ON UPDATE CASCADE ON DELETE CASCADE;
152
+
153
+
CREATE INDEX vehicle_submode_on_infrastruc_vehicle_submode_infrastructur_idx ON infrastructure_network.vehicle_submode_on_infrastructure_link USING btree (vehicle_submode, infrastructure_link_id);
154
+
END IF;
155
+
END $$;
100
156
101
157
-- Add the temporary link external source type is it doesn't exist
102
-
INSERT INTO infrastructure_network.external_source VALUES ('temp_hsl_tram') ON CONFLICT DO NOTHING;
158
+
INSERT INTO infrastructure_network.external_source VALUES ({external_link_source_sql}) ON CONFLICT DO NOTHING;
Copy file name to clipboardExpand all lines: sql/routing/create_routing_schema.sql
+32-8Lines changed: 32 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,8 @@ COMMENT ON COLUMN :schema.infrastructure_source.infrastructure_source_name IS
46
46
INSERT INTO :schema.infrastructure_source (infrastructure_source_id, infrastructure_source_name, description) VALUES
47
47
(1, 'digiroad_r_mml', 'Infrastructure links from the MML Maastotietokanta. The data is from the Digiroad R export and has been made available by Finnish Transport Infrastructure Agency (https://vayla.fi)'),
48
48
(2, 'digiroad_r_supplementary', 'Digiroad''s supplementary infrastructure links. The data is from the Digiroad R export and has been made available by Finnish Transport Infrastructure Agency (https://vayla.fi)'),
49
-
(100, 'hsl_fixup', 'HSL''s infrastructure link and stop point customisations on top of Digiroad infrastructure network');
49
+
(100, 'hsl_fixup', 'HSL''s infrastructure link and stop point customisations on top of Digiroad infrastructure network'),
50
+
(200, 'hsl_tram', 'HSL''s tram infrastructure links derived from the MML tram network');
50
51
51
52
--
52
53
-- Import infrastructure links
@@ -88,7 +89,24 @@ WHERE
88
89
-- 15, -- Erikoiskuljetusyhteys puomilla
89
90
21, -- Lossi
90
91
99-- Ei tietoa (esiintyy vain rakenteilla olevilla tielinkeillä)
91
-
);
92
+
)
93
+
UNION ALL
94
+
-- Tram infrastructure links from the HSL tram network. These are imported
95
+
-- separately from Digiroad links and are therefore not affected by the
96
+
-- GeoPackage fixup layer, which applies to Digiroad (bus) links only.
97
+
SELECT
98
+
t.id::bigintAS infrastructure_link_id,
99
+
isrc.infrastructure_source_id,
100
+
t.link_id::textAS external_link_id,
101
+
dir.traffic_flow_direction_type,
102
+
NULLAS municipality_code,
103
+
NULLAS external_link_type,
104
+
3AS external_link_state,
105
+
NULLAS name,
106
+
ST_Force3D(t.geom) AS geom_3d
107
+
FROM :source_schema.hsl_tram_linkki t
108
+
INNER JOIN :schema.traffic_flow_direction dir ONdir.traffic_flow_direction_type=t.ajosuunta
0 commit comments