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

Use ST_PointOnSurface for stations #3690

Merged
merged 4 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 30 additions & 28 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,6 @@ Layer:
properties:
minzoom: 12
- id: stations
class: stations
geometry: point
<<: *extents
Datasource:
Expand All @@ -1423,40 +1422,43 @@ Layer:
ref,
railway,
aerialway,
tags->'station' as "station",
station
FROM
(SELECT
ST_PointOnSurface(way) AS way,
name,
ref,
railway,
aerialway,
tags->'station' AS station,
way_area
FROM planet_osm_polygon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need a way && !bbox! here as well?

WHERE way && !bbox!
UNION ALL
SELECT
way,
name,
ref,
railway,
aerialway,
tags->'station' AS station,
NULL as way_area
FROM planet_osm_point
WHERE way && !bbox!
) _
WHERE railway IN ('station', 'halt', 'tram_stop')
OR railway = 'subway_entrance' AND way_area IS NULL
OR aerialway = 'station'
ORDER BY
CASE railway
WHEN 'station' THEN 1
WHEN 'subway_entrance' THEN 3
ELSE 2
END
AS prio
FROM planet_osm_point
WHERE railway IN ('station', 'halt', 'tram_stop', 'subway_entrance')
OR aerialway = 'station'
ORDER BY prio
END,
way_area DESC NULLS LAST
) AS stations
properties:
minzoom: 12
- id: stations-poly
class: stations
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
name,
ref,
railway,
aerialway,
tags->'station' as "station"
FROM planet_osm_polygon
WHERE railway IN ('station', 'halt', 'tram_stop')
OR aerialway = 'station'
) AS stations_poly
properties:
minzoom: 12
- id: amenity-points-poly
class: points
geometry: polygon
Expand Down
2 changes: 1 addition & 1 deletion stations.mss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@station-color: #7981b0;
@station-text: darken(saturate(@station-color, 15%), 10%);

.stations {
#stations {
[railway = 'subway_entrance'][zoom >= 18] {
marker-file: url('symbols/entrance.10.svg');
marker-placement: interior;
Expand Down