diff --git a/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.sld b/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.sld index 139d28be..2370aa54 100644 --- a/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.sld +++ b/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.sld @@ -13,7 +13,7 @@ Straßen-, Stadt und U-Bahn-Haltestelle - min_route_type + prio_route_type 0 @@ -33,7 +33,7 @@ Bus-Haltestelle - min_route_type + prio_route_type 3 @@ -53,7 +53,7 @@ Bahnhof - min_route_type + prio_route_type 2 @@ -84,7 +84,7 @@ - min_route_type D + render_prio D diff --git a/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.xml b/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.xml index f4c520b8..1e90169d 100644 --- a/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.xml +++ b/etc/geoserver/workspaces/MobiData-BW/styles/mdbw_transit_stations_default.xml @@ -10,5 +10,5 @@ mdbw_transit_stations_default.sld 2023-09-26 13:15:04.937 UTC - 2023-09-26 13:35:40.696 UTC + 2023-09-26 15:05:51.805 UTC \ No newline at end of file diff --git a/etc/gtfs/sql.d/31-geoserver-stations.sql b/etc/gtfs/sql.d/31-geoserver-stations.sql index 26c5f2de..e00e2c16 100644 --- a/etc/gtfs/sql.d/31-geoserver-stations.sql +++ b/etc/gtfs/sql.d/31-geoserver-stations.sql @@ -4,17 +4,22 @@ CREATE MATERIALIZED VIEW geoserver.stations_with_served_routes AS -- todo: is there something faster than min()? we just want *any* min(station_name) AS station_name, ST_Centroid(ST_Collect(stop_locs)) AS centroid, - -- todo: prefer "rail" (`2`) over "light rail" (`0`) - min(route_type::int) AS min_route_type, - json_object_agg(route_type, route_names) AS routes + -- prio_encoded_route_type has a multiple of 10000 added, which determines render prio (less is higher prio) + -- the last 4 digits represent the original route_type, so we need to modulo... + mod(min(prio_encoded_route_type::int),10000) AS prio_route_type, + json_object_agg(route_type, route_names) AS routes, + -- prio_encoded_route_type has a multiple of 10000 added, which determines render prio (less is higher prio) + min(prio_encoded_route_type::int) / 10000 AS render_prio FROM ( -- determine available routes for each (station, route_type) SELECT station_id, -- todo: is there something faster than min()? we just want *any* min(station_name) AS station_name, - ST_Collect(array_agg(stop_loc::geometry)) AS stop_locs, -- todo: distinct by stop_id? - route_type, -- todo: normalize into basic route type + ST_Collect(array_agg(stop_loc::geometry)) AS stop_locs, -- todo: distinct by stop_id?, + route_type, + -- todo: in case the feed uses extended route_types, these need to be handled here also + case when route_type=0 then '20000' when route_type=2 then '10002' when route_type between 3 and 9 then '3000'||route_type else '9000'||route_type end prio_encoded_route_type, array_agg(DISTINCT route_name) AS route_names FROM ( SELECT DISTINCT ON (stop_id, route_id)