fix(db): add sh, mv, bb, st, be, nw, he, sn, th, rp, sl, by and bw subset of stops that do not comply with Global ID

This commit is contained in:
dancingCycle 2023-08-22 09:31:24 +02:00
parent a970631eda
commit c5428fd6fe
1 changed files with 42 additions and 5 deletions

View File

@ -12,21 +12,56 @@ SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_al2_w_ntags_smplcty10_2
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_hb AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_hb_al4_w_ntags_smplcty10_20230818 AS de_hb ON ST_Intersects(stops.the_geom, de_hb.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_hh AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_hh_al4_w_ntags_smplcty10_20230818 AS de_hh ON ST_Intersects(stops.the_geom, de_hh.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_ni AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_ni_al4_w_ntags_smplcty10_20230818 AS de_ni ON ST_Intersects(stops.the_geom, de_ni.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_sh AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_sh_al4_w_ntags_smplcty10_20230818 AS de_sh ON ST_Intersects(stops.the_geom, de_sh.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_mv AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_mv_al4_w_ntags_smplcty10_20230818 AS de_mv ON ST_Intersects(stops.the_geom, de_mv.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_bb AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_bb_al4_w_ntags_smplcty10_20230818 AS de_bb ON ST_Intersects(stops.the_geom, de_bb.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_st AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_st_al4_w_ntags_smplcty10_20230818 AS de_st ON ST_Intersects(stops.the_geom, de_st.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_be AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_be_al4_w_ntags_smplcty10_20230818 AS de_be ON ST_Intersects(stops.the_geom, de_be.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_nw AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_nw_al4_w_ntags_smplcty10_20230818 AS de_nw ON ST_Intersects(stops.the_geom, de_nw.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_he AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_he_al4_w_ntags_smplcty10_20230818 AS de_he ON ST_Intersects(stops.the_geom, de_he.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_sn AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_sn_al4_w_ntags_smplcty10_20230818 AS de_sn ON ST_Intersects(stops.the_geom, de_sn.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_th AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_th_al4_w_ntags_smplcty10_20230818 AS de_th ON ST_Intersects(stops.the_geom, de_th.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_rp AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_rp_al4_w_ntags_smplcty10_20230818 AS de_rp ON ST_Intersects(stops.the_geom, de_rp.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_sl AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_sl_al4_w_ntags_smplcty10_20230818 AS de_sl ON ST_Intersects(stops.the_geom, de_sl.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_by AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_by_al4_w_ntags_smplcty10_20230818 AS de_by ON ST_Intersects(stops.the_geom, de_by.wkb_geometry) order by stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_bw AS
SELECT * FROM :schema_gtfs.stops AS stops JOIN public.de_bw_al4_w_ntags_smplcty10_20230818 AS de_bw ON ST_Intersects(stops.the_geom, de_bw.wkb_geometry) order by stop_id;
---create tables
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_hb AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_hb;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_hh AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_hh;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_ni AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_ni;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_sh AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_sh;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_mv AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_mv;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_bb AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_bb;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_st AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_st;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_be AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_be;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_nw AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_nw;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_he AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_he;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_sn AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_sn;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_th AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_th;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_rp AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_rp;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_sl AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_sl;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_by AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_by;
CREATE TABLE IF NOT EXISTS :schema.tbl_gtfs_stops_de_bw AS SELECT stop_id,stop_name,stop_lat,stop_lon,the_geom FROM :schema.vw_gtfs_stops_de_bw;
---get subset of stops in Germany and its states that do not comply with a proper Global ID
@ -36,11 +71,13 @@ CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_not_dhid AS SELECT * FROM :schem
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_hb_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_hb WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_hh_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_hh WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_ni_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_ni WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_sh_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_sh WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_mv_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_mv WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_bb_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_bb WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_st_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_st WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_beops_de_be_not_dhid AS SELECT * FROM :schema.tbl_gtfs_beops_de_be WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_beops_de_be_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_be WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_nw_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_nw WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_he_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_he WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;
CREATE OR REPLACE VIEW :schema.vw_gtfs_stops_de_sn_not_dhid AS SELECT * FROM :schema.tbl_gtfs_stops_de_sn WHERE stop_id NOT IN (SELECT dhid FROM :schema_gtfs.stops_zhv) AND stop_id NOT LIKE '%:%:%' ORDER BY stop_id;