Skip to content

Commit

Permalink
Merge pull request #3690 from pnorman/stations_point
Browse files Browse the repository at this point in the history
Use ST_PointOnSurface for stations
  • Loading branch information
pnorman authored Mar 10, 2019
2 parents 57d2fe3 + 0f378f6 commit cfe7cf4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
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
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

0 comments on commit cfe7cf4

Please sign in to comment.