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

Render maritime admin boundaries less prominently #2950

Closed
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
25 changes: 24 additions & 1 deletion admin.mss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@admin-boundaries: #ac46ac;
@admin-boundaries-maritime: darken(@water-color,20%);

/* For performance reasons, the admin border layers are split into three groups
for low, middle and high zoom levels.
Expand All @@ -16,6 +17,9 @@ overlapping borders correctly.
background/line-width: 1.2;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 1.2;
}
[zoom >= 5] {
Expand Down Expand Up @@ -43,6 +47,9 @@ overlapping borders correctly.
background/line-width: 0.6;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 0.6;
}
[zoom >= 7] {
Expand All @@ -63,6 +70,9 @@ overlapping borders correctly.
background/line-color: white;
background/line-width: 0.4;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-join: bevel;
line-width: 0.4;
line-clip: false;
Expand Down Expand Up @@ -116,6 +126,9 @@ overlapping borders correctly.
background/line-width: 2;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 2;
line-dasharray: 6,3,2,3,2,3;
line-clip: false;
Expand All @@ -126,6 +139,9 @@ overlapping borders correctly.
background/line-width: 2;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 2;
line-dasharray: 6,3,2,3;
line-clip: false;
Expand All @@ -138,6 +154,9 @@ overlapping borders correctly.
background/line-width: 1.5;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 1.5;
line-dasharray: 5,2;
line-clip: false;
Expand All @@ -147,7 +166,8 @@ overlapping borders correctly.
comp-op: darken;
}

#admin-high-zoom[zoom >= 13] {
#admin-high-zoom[zoom >= 13],
#admin-high-zoom-maritime[zoom >= 13] {
[admin_level = '9'],
[admin_level = '10'] {
[zoom >= 13] {
Expand All @@ -156,6 +176,9 @@ overlapping borders correctly.
background/line-width: 2;
line-join: bevel;
line-color: @admin-boundaries;
[maritime = 'true'] {
line-color: @admin-boundaries-maritime;
}
line-width: 2;
line-dasharray: 2,3;
line-clip: false;
Expand Down
63 changes: 54 additions & 9 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -1123,55 +1123,100 @@ Layer:
properties:
minzoom: 11
- id: admin-low-zoom
class: admin
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
(
(SELECT
way,
admin_level
admin_level,
'false' as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4')
AND osm_id < 0
ORDER BY admin_level DESC
)
UNION
(SELECT
way,
admin_level,
'true' as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4')
AND osm_id > 0
AND tags->'maritime' = 'yes'
)
ORDER BY maritime, admin_level DESC
) AS admin_low_zoom
properties:
minzoom: 4
maxzoom: 10
- id: admin-mid-zoom
class: admin
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
(
(SELECT
way,
admin_level
admin_level,
'false'as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8')
AND osm_id < 0
ORDER BY admin_level DESC
)
UNION
(SELECT
way,
admin_level,
'true' as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8')
AND osm_id > 0
AND tags->'maritime' = 'yes'
)
ORDER BY maritime, admin_level DESC
) AS admin_mid_zoom
properties:
minzoom: 11
maxzoom: 12
- id: admin-high-zoom
class: admin
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
(
(SELECT
way,
admin_level
admin_level::integer, -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering
'false' as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND osm_id < 0
ORDER BY admin_level::integer DESC -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering
)
UNION
(SELECT
way,
admin_level::integer, -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering
'true' as maritime
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND osm_id > 0
AND tags->'maritime' = 'yes'
)
ORDER BY maritime, admin_level DESC
) AS admin_high_zoom
properties:
minzoom: 13
Expand Down