Skip to content

Commit 975555f

Browse files
committed
PR review
1 parent 6650811 commit 975555f

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

analysers/analyser_osmosis_relation_public_transport.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@
399399
WHEN last_roundabout IS NOT NULL THEN
400400
CASE
401401
WHEN ST_Intersects(last_roundabout,ST_StartPoint(f.geom)) THEN
402-
CASE
402+
CASE
403403
WHEN ST_LineLocatePoint(last_roundabout, ST_EndPoint(full_way)) > ST_LineLocatePoint(last_roundabout, ST_StartPoint(f.geom)) THEN
404404
full_way:= ST_MakeLine(full_way,ST_LineSubstring(last_roundabout, ST_LineLocatePoint(last_roundabout, ST_EndPoint(full_way)), 1));
405405
full_way:= ST_MakeLine(full_way,ST_LineSubstring(last_roundabout, 0, ST_LineLocatePoint(last_roundabout, ST_StartPoint(f.geom))));
@@ -408,7 +408,7 @@
408408
END CASE;
409409
full_way:= ST_MakeLine(full_way,f.geom);
410410
WHEN ST_Intersects(last_roundabout,ST_EndPoint(f.geom)) THEN
411-
CASE
411+
CASE
412412
WHEN ST_LineLocatePoint(last_roundabout, ST_EndPoint(full_way)) > ST_LineLocatePoint(last_roundabout, ST_EndPoint(f.geom)) THEN
413413
full_way:= ST_MakeLine(full_way,ST_LineSubstring(last_roundabout, ST_LineLocatePoint(last_roundabout, ST_EndPoint(full_way)), 1));
414414
full_way:= ST_MakeLine(full_way,ST_LineSubstring(last_roundabout, 0, ST_LineLocatePoint(last_roundabout, ST_EndPoint(f.geom))));
@@ -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

@@ -566,7 +564,7 @@ def __init__(self, config, logger = None):
566564
self.callbackA0 = lambda res: {"class":10, "data":[self.node_full, self.positionAsText]}
567565
self.callback100 = lambda res: {"class":11, "data":[self.relation_full, self.positionAsText]}
568566
self.callback110 = lambda res: {"class":12, "data":[self.relation_full, self.any_full, self.positionAsText]}
569-
567+
570568
if self.config.options.get("driving_side") == "left":
571569
self.buffer_driving_side = "left"
572570
else:

0 commit comments

Comments
 (0)