Skip to content

Commit

Permalink
Change initial zoom level for admin-boundaries-text by admin_level at…
Browse files Browse the repository at this point in the history
… z11 to z16

Add way_pixels limits for admin 1 to 4 same as largest central text label rendering, at 48,000 way_pixels for higher admin_level which have no other text labels
  • Loading branch information
jeisenbe committed Feb 7, 2019
1 parent d4d7d55 commit 6ecdb84
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
38 changes: 24 additions & 14 deletions admin.mss
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,30 @@ overlapping borders correctly.
comp-op: darken;
}

#admin-text[zoom >= 16] {
text-name: "[name]";
text-face-name: @book-fonts;
text-fill: @admin-boundaries;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-largest-bbox-only: false;
text-placement: line;
text-spacing: 750;
text-repeat-distance: 250;
text-margin: 10;
text-clip: true;
text-vertical-alignment: middle;
text-dy: -10;
#admin-text[zoom >= 11][way_pixels >= 48000] {
[admin_level = '1'][way_pixels >= 360000],
[admin_level = '2'][way_pixels >= 360000],
[admin_level = '3'][way_pixels >= 196000],
[admin_level = '4'][way_pixels >= 196000],
[zoom >= 12][admin_level = '5'],
[zoom >= 13][admin_level = '6'],
[zoom >= 14][admin_level = '7'],
[zoom >= 15][admin_level = '8'],
[zoom >= 16] {
text-name: "[name]";
text-face-name: @book-fonts;
text-fill: @admin-boundaries;
text-halo-radius: @standard-halo-radius;
text-halo-fill: @standard-halo-fill;
text-largest-bbox-only: false;
text-placement: line;
text-spacing: 750;
text-repeat-distance: 250;
text-margin: 10;
text-clip: true;
text-vertical-alignment: middle;
text-dy: -10;
}
}

#protected-areas-text[zoom >= 13][way_pixels > 192000] {
Expand Down
7 changes: 4 additions & 3 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -2549,15 +2549,16 @@ Layer:
(SELECT
way,
name,
admin_level
admin_level,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
FROM planet_osm_polygon
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND admin_level IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND name IS NOT NULL
ORDER BY admin_level::integer ASC, way_area DESC
) AS admin_text
properties:
minzoom: 16
minzoom: 11
- id: protected-areas-text
geometry: linestring
<<: *extents
Expand Down

0 comments on commit 6ecdb84

Please sign in to comment.