Skip to content

Commit

Permalink
Create spatial index for shapes_with_routes_shape...
Browse files Browse the repository at this point in the history
... and set srid to 4326, as it is not yet declared for shapes.aggregated.
See also public-transport/gtfs-via-postgres#48
  • Loading branch information
hbruch committed Sep 26, 2023
1 parent b7136ce commit 7e3d514
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions etc/gtfs/sql.d/32-geoserver-shapes.sql
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);

0 comments on commit 7e3d514

Please sign in to comment.