From 7e3d514c137f10f3c1ba6bcd96f5f9bf0ca6797a Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Tue, 26 Sep 2023 18:26:25 +0200 Subject: [PATCH] Create spatial index for shapes_with_routes_shape... ... and set srid to 4326, as it is not yet declared for shapes.aggregated. See also https://github.com/public-transport/gtfs-via-postgres/issues/48 --- etc/gtfs/sql.d/32-geoserver-shapes.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/gtfs/sql.d/32-geoserver-shapes.sql b/etc/gtfs/sql.d/32-geoserver-shapes.sql index 50c44069..fc514e67 100644 --- a/etc/gtfs/sql.d/32-geoserver-shapes.sql +++ b/etc/gtfs/sql.d/32-geoserver-shapes.sql @@ -1,7 +1,7 @@ CREATE MATERIALIZED VIEW geoserver.shapes_with_routes AS SELECT shape_id, - min(shape) AS shape, + st_setsrid(min(shape), 4326) AS shape, route_type, array_to_string(array_agg(DISTINCT route_id), ', ') AS route_ids, array_to_string(array_agg(DISTINCT route_name), ', ') AS route_names @@ -20,4 +20,6 @@ CREATE MATERIALIZED VIEW geoserver.shapes_with_routes AS GROUP BY shape_id, route_type; -- todo: primary/unique key? --- todo: spatial index? +CREATE INDEX shapes_with_routes_shape_idx + ON geoserver.shapes_with_routes + USING GIST (shape); \ No newline at end of file