Skip to content

Commit

Permalink
Unify code of power=tower and power=pole (gravitystorm#3561)
Browse files Browse the repository at this point in the history
* unify code of power=tower and power=pole

* invert pole and tower

* add ORDER condition

* fix ORDER BY
  • Loading branch information
jragusa authored and imagico committed May 21, 2019
1 parent 816f726 commit 728032e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 30 deletions.
27 changes: 13 additions & 14 deletions power.mss
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,20 @@
}

#power-towers {
[zoom >= 14] {
marker-file: url('symbols/man_made/power_tower_small.svg');
marker-width: 3;
}
[zoom >= 15] {
marker-file: url('symbols/man_made/power_tower.svg');
marker-width: 5;
}
[zoom >= 17] {
marker-width: 7;
[power = 'tower'] {
[zoom >= 14] {
marker-file: url('symbols/man_made/power_tower_small.svg');
marker-width: 3;
}
[zoom >= 15] {
marker-file: url('symbols/man_made/power_tower.svg');
marker-width: 5;
}
[zoom >= 17] {
marker-width: 7;
}
}
}

#power-poles {
[zoom >= 16] {
[power = 'pole'][zoom >= 16] {
marker-file: url('symbols/square.svg');
marker-fill: #928f8f;
marker-width: 3;
Expand Down
26 changes: 10 additions & 16 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1707,25 +1707,19 @@ Layer:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_point
WHERE power = 'tower'
way,
power
FROM planet_osm_point
WHERE power IN ('tower', 'pole')
ORDER BY
CASE
WHEN power = 'tower' THEN 1
WHEN power = 'pole' THEN 2
ELSE NULL
END
) AS power_towers
properties:
minzoom: 14
- id: power-poles
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM planet_osm_point
WHERE power = 'pole'
) AS power_poles
properties:
minzoom: 16
- id: roads-text-ref-low-zoom
geometry: linestring
<<: *extents
Expand Down

0 comments on commit 728032e

Please sign in to comment.