Skip to content

Commit 2b5d9ce

Browse files
committed
PR review
1 parent d2a94b1 commit 2b5d9ce

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

analysers/analyser_osmosis_relation_public_transport.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@
475475
ROW_NUMBER () OVER (PARTITION BY route_linestring.id
476476
ORDER BY stop_platform.morder) AS stop_order,
477477
ROW_NUMBER () OVER (PARTITION BY route_linestring.id
478-
ORDER BY ST_LineLocatePoint(ST_OffsetCurve(route_linestring.geom, -10), stop_platform.geom) DESC) AS projected_stop_order
478+
ORDER BY ST_LineLocatePoint(ST_OffsetCurve(route_linestring.geom, -10), stop_platform.geom) DESC) AS projected_stop_order,
479+
(CASE
480+
WHEN LEAD(stop_platform.morder, 1) OVER (PARTITION BY route_linestring.id
481+
ORDER BY stop_platform.morder) IS NULL THEN 1
482+
ELSE 0
483+
END) AS is_last_platform
479484
FROM stop_platform
480485
JOIN route_linestring ON route_linestring.id = stop_platform.id
481486
WHERE stop_platform.mrole IN ('platform',
@@ -506,17 +511,10 @@
506511
ST_AsText(ST_Transform(platform_that_can_project.stop, 4326))
507512
FROM platform_that_can_project
508513
JOIN route_linestring ON route_linestring.id = platform_that_can_project.route_id
509-
JOIN (
510-
SELECT
511-
platform_that_can_project.route_id AS route_id,
512-
MAX(platform_that_can_project.stop_order) AS last_platform
513-
FROM platform_that_can_project
514-
GROUP BY platform_that_can_project.route_id
515-
) AS y ON platform_that_can_project.route_id = y.route_id
516514
WHERE ST_DWithin(route_linestring.geom, platform_that_can_project.stop, 50) AND
517515
NOT ST_Intersects(ST_Buffer(route_linestring.geom, 50, 'side={}'), platform_that_can_project.stop) AND
518516
route_linestring.public_transport_mode IN ('bus', 'trolleybus', 'coach', 'share_taxi', 'school_bus') AND
519-
platform_that_can_project.stop_order <> last_platform AND
517+
platform_that_can_project.is_last_platform <> 1 AND
520518
platform_that_can_project.stop_order <> 1
521519
"""
522520

0 commit comments

Comments
 (0)