|
475 | 475 | ROW_NUMBER () OVER (PARTITION BY route_linestring.id |
476 | 476 | ORDER BY stop_platform.morder) AS stop_order, |
477 | 477 | 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 |
479 | 484 | FROM stop_platform |
480 | 485 | JOIN route_linestring ON route_linestring.id = stop_platform.id |
481 | 486 | WHERE stop_platform.mrole IN ('platform', |
|
506 | 511 | ST_AsText(ST_Transform(platform_that_can_project.stop, 4326)) |
507 | 512 | FROM platform_that_can_project |
508 | 513 | 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 |
516 | 514 | WHERE ST_DWithin(route_linestring.geom, platform_that_can_project.stop, 50) AND |
517 | 515 | NOT ST_Intersects(ST_Buffer(route_linestring.geom, 50, 'side={}'), platform_that_can_project.stop) AND |
518 | 516 | 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 |
520 | 518 | platform_that_can_project.stop_order <> 1 |
521 | 519 | """ |
522 | 520 |
|
|
0 commit comments