Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing SRID 4326 for shapes_aggregated.shape #48

Open
hbruch opened this issue Sep 26, 2023 · 1 comment
Open

Missing SRID 4326 for shapes_aggregated.shape #48

hbruch opened this issue Sep 26, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@hbruch
Copy link

hbruch commented Sep 26, 2023

I suggest to explicitly set SRID 4326 for shape geometries in shapes_aggregated, e.g.

ST_SetSRID(4326, ST_MakeLine(array_agg(shape_pt_loc))) AS shape

That way, subsequent (materialized) views coud create a spatial index like e.g.

CREATE INDEX my_shapes_aggregated_view_shape_idx
ON my_shapes_aggregated_view_shape
USING GIST (shape);
hbruch added a commit to mobidata-bw/ipl-orchestration that referenced this issue Sep 26, 2023
... and set srid to 4326, as it is not yet declared for shapes.aggregated.
See also public-transport/gtfs-via-postgres#48
hbruch added a commit to mobidata-bw/ipl-orchestration that referenced this issue Sep 27, 2023
... and set srid to 4326, as it is not yet declared for shapes.aggregated.
See also public-transport/gtfs-via-postgres#48
hbruch added a commit to mobidata-bw/ipl-orchestration that referenced this issue Sep 28, 2023
... and set srid to 4326, as it is not yet declared for shapes.aggregated.
See also public-transport/gtfs-via-postgres#48
@derhuerst
Copy link
Member

I suggest to explicitly set SRID 4326 for shape geometries in shapes_aggregated. That way, subsequent (materialized) views coud create a spatial index […].

I'm not sure what you're hinting at, as AFAICT this is possible even today:

CREATE MATERIALIZED VIEW shapes_aggregated_mat AS
SELECT shape_id, shape
FROM api.shapes_aggregated;

CREATE INDEX ON shapes_aggregated_mat
USING GIST (shape);

-- Using the 2023-09-16 bwgesamt (beta) GTFS feed, I have verified that it uses the spatial index.
SELECT shape_id, shape
FROM shapes_aggregated_mat
WHERE shape && ST_MakeBox2D(ST_Point(9.3, 48.49, 4326), ST_Point(9.29, 48.5, 4326))

Nevertheless, given that GTFS Latitudes & Longitudes are defined as WGS 84, it shouldn't hurt – but instead provide additional context – to specify shapes.shape_pt_loc as SRID 4326; This way, the shapes_aggregated.shape should be in SRID 4326 too, right?

@derhuerst derhuerst added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Development

No branches or pull requests

2 participants