-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlabel.mss
382 lines (353 loc) · 10.3 KB
/
label.mss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
// LABEL.MSS CONTENTS:
// 1__ Ocean & Marine Labels
// 2__ Place Names
// 2_1__ Countries
// 2_2__ States
// 2_3__ Cities
// 2_4__ Towns
// 2_5__ Villages
// 2_6__ Suburbs
// 2_7__ Neighbourhoods & Hamlets
// 4__ Water Labels
// 5__ Road Labels
// Font sets are defined in vars.mss
// =====================================================================
// 1__ OCEAN & MARINE LABELS
// =====================================================================
#marine_label["mapnik::geometry_type"=1],
#marine_label["mapnik::geometry_type"=2] {
::rank1 [labelrank=1][zoom>=3],
::rank2 [labelrank=2][zoom>=4],
::rank3 [labelrank=3][zoom>=5],
::rank4 [labelrank=4][zoom>=6],
::rank5 [labelrank=5][zoom>=7],
::rank6 [labelrank=6][zoom>=8] {
text-name: @name;
text-face-name: @sans_italic;
text-size: 15;
text-transform: uppercase;
text-character-spacing: 8;
text-line-spacing: 8;
text-fill: lighten(@water,30);
["mapnik::geometry_type"=1] {
text-placement: point;
text-wrap-width: 50;
text-wrap-before: true;
}
["mapnik::geometry_type"=2] {
text-placement: line;
text-avoid-edges: true;
}
}
}
// =====================================================================
// 2__ PLACE NAMES
// =====================================================================
// Countries and States/Provinces ______________________________________
#ne_10m_admin_0_countries_lakes[name!='USNB Guantanamo Bay'],
#ne_10m_admin_1_label_points[adm0_sr=1][zoom>=4][scalerank<=2],
#ne_10m_admin_1_label_points[adm0_sr=1][zoom>=6] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @city_text;
text-halo-fill: #fff;
text-halo-radius: 2;
text-halo-rasterizer: fast;
text-wrap-width: 40;
text-line-spacing: -4;
//text-size: 10;
text-wrap-width: 60;
[scalerank<8] { text-size: 11; }
[scalerank<6] { text-size: 12; }
[scalerank<4] { text-size: 14; }
[scalerank<2] { text-size: 18; } // only admin 0 has this
}
// 2_3__ Cities ________________________________________________________
#place_label[type='city'][zoom>=8][zoom<=15] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @city_text;
text-halo-fill: #fff;
text-halo-radius: 2;
text-halo-rasterizer: fast;
text-wrap-width: 40;
text-line-spacing: -4;
[zoom=8] {
text-size: 13;
text-wrap-width: 60;
}
[zoom=9] {
text-size: 14;
text-wrap-width: 60;
}
[zoom=10] {
text-size: 15;
text-wrap-width: 70;
}
[zoom=11] {
text-size: 16;
text-wrap-width: 80;
}
[zoom=12] {
text-size: 17;
text-wrap-width: 100;
}
[zoom=13] {
text-size: 18;
text-wrap-width: 200;
}
[zoom=14] {
text-fill: lighten(@city_text,10);
text-size: 19;
text-wrap-width: 300;
}
[zoom=15] {
text-fill: lighten(@city_text,10);
text-size: 20;
text-wrap-width: 400;
}
}
// 2_4__ Towns _________________________________________________________
#place_label[type='town'][zoom>=8][zoom<=17] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @town_text;
text-halo-fill: @town_halo;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-wrap-width: 75;
text-wrap-before: true;
text-line-spacing: -4;
text-size: 11;
[zoom>=8] { text-size: 12; }
[zoom>=10] { text-size: 13; text-halo-radius: 2; }
[zoom>=11] { text-size: 14; }
[zoom>=12] { text-size: 15; text-wrap-width: 80; }
[zoom>=13] { text-size: 16; text-wrap-width: 120; }
[zoom>=14] { text-size: 18; text-wrap-width: 160; }
[zoom>=15] { text-size: 20; text-wrap-width: 200; }
[zoom>=16] { text-size: 22; text-wrap-width: 240; }
}
// 2_5 Villages ______________________________________________________
#place_label[type='village'][zoom>=15][zoom<=17] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @town_text;
text-size: 11;
text-halo-fill: @town_halo;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-wrap-width: 60;
text-wrap-before: true;
text-line-spacing: -4;
[zoom>=12] { text-size: 12; }
[zoom>=13] { text-wrap-width: 80; }
[zoom>=14] { text-size: 14; text-wrap-width: 100; }
[zoom>=15] { text-size: 16; text-wrap-width: 120; }
[zoom>=16] { text-size: 18; text-wrap-width: 160; }
[zoom=17] { text-size: 20; text-wrap-width: 200; }
}
// 2_6__ Suburbs _______________________________________________________
#place_label[type='suburb'][zoom>=15][zoom<=18] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @other_text;
text-size: 11;
text-halo-fill: @other_halo;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-wrap-width: 60;
text-wrap-before: true;
text-line-spacing: -2;
[zoom>=12] { text-size: 10; text-min-distance: 20; }
[zoom>=13] { text-size: 12; text-min-distance: 20; }
[zoom>=14] { text-size: 13; text-wrap-width: 80; }
[zoom>=15] { text-size: 14; text-wrap-width: 120; }
[zoom>=16] { text-size: 16; text-wrap-width: 160; }
[zoom>=17] { text-size: 20; text-wrap-width: 200; }
}
// 2_7__ Neighbourhoods & Hamlets ______________________________________
#place_label[zoom>=15][zoom<=18] {
[type='hamlet'],
[type='neighbourhood'] {
text-name: @name;
text-face-name: @sans;
text-placement: point;
text-fill: @other_text;
text-size: 11;
text-halo-fill: @other_halo;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-wrap-width: 60;
text-wrap-before: true;
text-line-spacing: -2;
[zoom>=13] { text-size: 8; text-wrap-width: 60; }
[zoom>=14] { text-size: 12; text-wrap-width: 80; }
[zoom>=16] { text-size: 14; text-wrap-width: 100; }
[zoom>=17] { text-size: 16; text-wrap-width: 130; }
[zoom>=18] { text-size: 18; text-wrap-width: 160; }
}
}
// =====================================================================
// 4__ WATER LABELS
// =====================================================================
#water_label {
[zoom<=15][area>200000],
[zoom=16][area>50000],
[zoom=17][area>10000],
[zoom>=18][area>0]{
text-name: @name;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-size: 11;
text-wrap-width: 50;
text-wrap-before: true;
text-halo-fill: #fff;
text-line-spacing: -2;
text-face-name: @sans_italic;
text-fill: @water * 0.75;
}
[zoom>=14][area>3200000],
[zoom>=15][area>800000],
[zoom>=16][area>200000],
[zoom>=17][area>50000],
[zoom>=18][area>10000] {
text-size: 12;
text-wrap-width: 75;
}
[zoom>=15][area>3200000],
[zoom>=16][area>800000],
[zoom>=17][area>200000],
[zoom>=18][area>50000] {
text-size: 14;
text-wrap-width: 100;
text-halo-radius: 2;
}
[zoom>=16][area>3200000],
[zoom>=17][area>800000],
[zoom>=18][area>200000] {
text-size: 16;
text-wrap-width: 125;
}
[zoom>=17][area>3200000],
[zoom>=18][area>800000] {
text-size: 18;
text-wrap-width: 150;
}
}
#ne_10m_rivers_lake_centerlines_scale_rank_labels[zoom=4][scalerank<4],
#ne_10m_rivers_lake_centerlines_scale_rank_labels[zoom=5][scalerank<5],
#ne_10m_rivers_lake_centerlines_scale_rank_labels[zoom=6][scalerank<6],
#ne_10m_rivers_lake_centerlines_scale_rank_labels[zoom=7][scalerank<7],
#ne_10m_rivers_lake_centerlines_scale_rank_labels[zoom>=8] {
text-avoid-edges: true;
text-name: @name;
text-face-name: @sans_italic;
text-fill: @water * 0.75;
text-halo-fill: fadeout(#fff,80%);
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-placement: line;
text-size: 10;
}
#waterway_label {
::river [class='river'][zoom>=13],
::canal [class='canal'][zoom>=15],
::stream [class='stream'][zoom>=17],
::intermittent [class='stream_intermittent'][zoom>=17] {
text-avoid-edges: true;
text-name: @name;
text-face-name: @sans_italic;
text-fill: @water * 0.75;
text-halo-fill: fadeout(#fff,80%);
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-placement: line;
text-size: 10;
text-character-spacing: 1;
}
}
// =====================================================================
// 5__ ROAD LABELS
// =====================================================================
// highway shield
#roads-text-ref[width<=10][height<=4] {
shield-name: "[refs]";
shield-size: 9;
shield-file: url('img/shield/default_[width]x[height].svg');
shield-face-name: @sans_bold;
shield-fill: #555;
shield-spacing: 200;
shield-avoid-edges: true;
// Workaround for Mapnik bug where shields are placed slightly over the
// edge even when avoid-edges is true:
shield-min-padding: 5;
shield-min-distance: 40;
[zoom>=12] { shield-min-distance: 50; }
[zoom>=14] {
shield-spacing: 400;
shield-min-distance: 80;
}
}
// regular labels
//#road_label['mapnik::geometry_type'=2] {
#road_label {
[class='motorway'][zoom>=12],
[class='trunk'][zoom>=12],
[class='primary'][zoom>=12],
[class='secondary'][zoom<=14],
[class='tertiary'][zoom<=14],
[class='residential'][zoom>=15],
[class='path'][zoom>=16],
[class='service'][zoom>=16],
[class='footway'][zoom>=16],
[class='unclassified'][zoom>=16],
[class='cycleway'][zoom>=16],
[class='living_street'][zoom>=16],
[class='road'][zoom>=16] {
text-avoid-edges: true;
text-transform: uppercase;
text-name: @name;
text-character-spacing: 0.25;
text-placement: line;
text-face-name: @sans;
text-fill: #444;
text-size: 8;
text-halo-fill: @road_halo;
text-halo-radius: 1.5;
text-halo-rasterizer: fast;
text-min-distance: 200; // only for labels w/ the same name
[zoom>=14] { text-size: 9; }
[zoom>=16] { text-size: 11; }
[zoom>=18] { text-size: 12; }
[class='motorway'],
[class='trunk'],
[class='primary'] {
[zoom>=14] { text-size: 10; }
[zoom>=16] { text-size: 11; text-face-name: @sans_bold; }
[zoom>=17] { text-size: 12; }
[zoom>=18] { text-size: 14; }
}
}
}
// =====================================================================
// ADDRESS LABELS
// =====================================================================
#housenum_label[zoom>=18] {
text-name:'[house_num]';
text-face-name: @sans_italic;
text-fill: darken(@building, 50%);
text-wrap-width: 50;
text-wrap-before: true;
text-placement:point;
text-size: 9;
[zoom>=19] {
text-size: 11;
text-character-spacing: -0.5;
}
}