]> git.0d.be Git - hdm-toner-cartocss.git/blob - labels.mss
adjust name and compare url
[hdm-toner-cartocss.git] / labels.mss
1 /* LABELS.MSS CONTENTS:
2  * - Place names
3  * - POI labels
4  * - Area labels
5  * - Waterway labels
6  * - Road labels
7  * - Oneway arrows
8  * - Admin labels
9  * - Housenumbers
10  */
11
12 /* Font sets are defined in palette.mss */
13
14 /* Mapnik does not yet support character-spacing adjustments for
15    labels placed along a line. We can fake this using the replace()
16    function in the text-name parameter by replacing each character
17    with itself followed by one or more spaces. */
18
19 /* ================================================================== */
20 /* PLACE NAMES
21 /* ================================================================== */
22
23 /* ---- Countries --------------------------------------------------- */
24
25 #low_place[type='country'][zoom>=3][zoom<=7] {
26   text-name:'[name]';
27   text-face-name: @bold;
28   text-placement: point;
29   text-fill: @country_text;
30   text-halo-fill: @country_halo;
31   text-halo-radius: 1;
32   [zoom=3] {
33     text-size: 9;
34     text-wrap-width: 40;
35   }
36   [zoom>=4] {
37     text-size: 11;
38     text-wrap-width: 50;
39   }
40   [zoom>=5] {
41     text-halo-radius: 2;
42     text-wrap-width: 50;
43     text-line-spacing: 1;
44   }
45   [zoom=6] {
46     text-size: 13;
47     text-character-spacing: 0;
48     text-wrap-width: 80;
49     text-line-spacing: 2;
50   }
51   [zoom=7] {
52     text-size: 14;
53     text-character-spacing: 1;
54   }
55 }
56
57 /* ---- States ------------------------------------------------------ */
58
59 #low_place[type='state'][zoom>=5][zoom<=10] {
60   text-name:'[name]';
61   text-face-name: @bold;
62   text-placement: point;
63   text-fill: @state_text;
64   text-halo-fill: @state_halo;
65   text-halo-radius: 1;
66   [zoom=5] {
67     text-size:9 + @text_adjust;
68     text-wrap-width: 35;
69   }
70   [zoom=6] {
71     text-size:10 + @text_adjust;
72     text-wrap-width: 40;
73   }
74   [zoom=7] {
75     text-size:11 + @text_adjust;
76     text-wrap-width: 50;
77   }
78   [zoom>8] {
79     text-halo-radius: 2;
80   }
81   [zoom=8] {
82     text-size:11 + @text_adjust;
83     text-wrap-width: 50;
84     text-line-spacing: 1;
85   }
86   [zoom=9] {
87     text-size:12 + @text_adjust;
88     text-character-spacing: 1;
89     text-wrap-width: 80;
90     text-line-spacing: 2;
91   }
92   [zoom=10] {
93     text-size:14 + @text_adjust;
94     text-character-spacing: 2;
95   }
96 }
97
98 /* ---- Cities and Towns ----------------------------------------------- */
99
100 #low_place[is_capital='country'][zoom>=4][zoom<=10],
101 #low_place[type='city'][zoom>=7][zoom<=10],
102 #low_place[type='town'][zoom>=9][zoom<=10] {
103   shield-file: url('icons/place/town.png');
104   [type='city'] {
105     shield-file: url('icons/place/city.png');
106   }
107   [is_capital='country'] {
108     shield-file: url('icons/place/country_capital.png');
109   }
110   shield-name:'[name]';
111   shield-size: 9;
112   shield-face-name: @medium;
113   shield-halo-radius: 1;
114   shield-wrap-width: 50;
115   shield-fill: @town_text;
116   shield-halo-fill: @town_halo;
117   shield-placement-type: simple;
118   shield-placements: 'NE,SW,NW,SE,E,W';
119   shield-text-dy: 3;
120   shield-text-dx: 3;
121   shield-unlock-image: true;
122   shield-min-distance: 10;
123   [type='city'] {
124     shield-fill: @city_text;
125     shield-halo-fill: @city_halo;
126     shield-size: 10;
127   }
128   [is_capital='country'] {
129     shield-face-name: @bold;
130     shield-fill: @capital_text;
131     shield-halo-fill: @capital_halo;
132     shield-size: 11;
133     shield-line-spacing: -2;
134     shield-text-dx: 4;
135   }
136   [zoom>=10] {
137     shield-halo-radius: 2;
138     shield-size: 10;
139     [type='city'] { shield-size: 11;}
140     [is_capital='country'] { shield-size: 11;}
141   }
142 }
143
144 #place[type='city'][zoom>=11][zoom<=15],
145 #place[type='town'][zoom>=11][zoom<=17] {
146   text-name:'[name]';
147   text-size: 11;
148   text-face-name: @medium;
149   text-halo-radius: 2;
150   text-wrap-width: 50;
151   text-fill: @town_text;
152   text-halo-fill: @town_halo;
153   text-character-spacing: -1;
154   [type='city'] {
155     text-fill: @city_text;
156     text-halo-fill: @city_halo;
157     text-size: 12;
158   }
159   [is_capital='country'] {
160     text-face-name: @bold;
161     text-fill: @capital_text;
162     text-halo-fill: @capital_halo;
163     text-line-spacing: -2;
164     text-transform: uppercase;
165   }
166   [zoom>=12] {
167     text-size: 12;
168     [type='city'],
169     [is_capital='country'] { text-size: 13;}
170   }
171   [zoom>=13] {
172     text-transform: uppercase;
173     text-character-spacing: 0;
174     [type='city'],
175     [is_capital='country'] { text-size: 14;}
176   }
177   [zoom>=14]{
178     text-size:13;
179     text-character-spacing: 1;
180     [type='city'],
181     [is_capital='country'] { text-size: 15;}
182   }
183   [zoom>=15]{
184     text-size:14;
185     text-character-spacing: 2;
186     [type='city'],
187     [is_capital='country'] { text-size: 16;}
188   }
189   [zoom>=16]{
190     text-size:15;
191     text-line-spacing: 5;
192   }
193   [zoom>=17]{
194     text-size:16;
195     text-line-spacing: 6;
196   }
197 }
198
199
200
201 /* ---- Other small places ------------------------------------------ */
202
203 #place::small[type='village'][zoom>=11][zoom<=20],
204 #place::small[type='suburb'][zoom>=13][zoom<=20],
205 #place::small[type='hamlet'][zoom>=13][zoom<=20],
206 #place::small[type='neighbourhood'][zoom>=13][zoom<=20] {
207   text-name:'[name]';
208   text-face-name:@medium;
209   text-placement:point;
210   text-fill:@other_text;
211   text-size:10;
212   text-halo-fill:@other_halo;
213   text-halo-radius:1;
214   text-wrap-width: 30;
215   text-min-distance: 100;
216   text-avoid-edges: true;
217   text-label-position-tolerance: 10;
218   [zoom>=13] {
219     text-min-distance: 50;
220   }
221   [zoom>=14] {
222     text-size:11;
223     text-character-spacing: 0;
224     text-wrap-width: 40;
225     text-line-spacing: 1;
226   }
227   [zoom>=15] {
228     text-halo-radius: 2;
229     text-transform: uppercase;
230     text-character-spacing: 0;
231     text-wrap-width: 60;
232     text-line-spacing: 1;
233     text-min-distance: 30;
234   }
235   [zoom>=16] {
236     text-size:12;
237     text-character-spacing: 1;
238     text-wrap-width: 120;
239     text-line-spacing: 2;
240     text-min-distance: 10;
241   }
242   [zoom>=17] {
243     text-size:13;
244     text-character-spacing: 2;
245     text-wrap-width: 160;
246     text-line-spacing: 4;
247   }
248   [zoom>=18] {
249     text-size:14;
250     text-character-spacing: 3;
251     text-line-spacing: 6;
252   }
253 }
254
255 #place::small[type='locality'][zoom>=15] {
256   text-name:'[name]';
257   text-face-name:@medium;
258   text-placement:point;
259   text-fill:@locality_text;
260   text-size:9;
261   text-halo-fill:@locality_halo;
262   text-halo-radius:1;
263   text-wrap-width: 30;
264   [zoom>=16] {
265     text-size:10;
266     text-wrap-width: 60;
267     text-line-spacing: 1;
268   }
269   [zoom>=17] {
270     text-size:11;
271     text-wrap-width: 120;
272     text-line-spacing: 2;
273   }
274   [zoom>=18] {
275     text-size:12;
276     text-character-spacing: 0;
277     text-line-spacing: 4;
278   }
279 }
280
281
282 // =====================================================================
283 // AREA LABELS
284 // =====================================================================
285
286 #area_label {
287   // Bring in labels gradually as one zooms in, bases on polygon area
288   [zoom>=12][area>102400000],
289   [zoom>=13][area>25600000],
290   [zoom>=14][area>1600000],
291   [zoom>=15][area>320000],
292   [zoom>=16][area>80000],
293   [zoom>=17][area>20000],
294   [zoom>=18][area>5000],
295   [zoom>=19][area>=0] {
296     text-name: "[name]";
297     text-halo-radius: 1.5;
298     text-face-name: @medium;
299     text-size: 11;
300     text-wrap-width: 30;
301     text-fill: #888;
302     text-halo-fill: #fff;
303     // Specific style overrides for different types of areas:
304     [type='park'][zoom>=10] {
305       text-face-name: @regular;
306       text-fill: #000000;
307       text-halo-fill: #FFFFFF;
308     }
309     [type='golf_course'][zoom>=10] {
310       text-fill: @sports * 0.6;
311       text-halo-fill: lighten(@sports, 10);
312     }
313     [type='cemetery'][zoom>=10] {
314       text-fill: @cemetery * 0.6;
315       text-halo-fill: lighten(@cemetery, 10);
316     }
317     [type='hospital'][zoom>=10] {
318       text-fill: @hospital * 0.6;
319       text-halo-fill: lighten(@hospital, 10);
320     }
321     [type='college'][zoom>=10],
322     [type='school'][zoom>=10],
323     [type='university'][zoom>=10] {
324       text-fill: @school * 0.6;
325       text-halo-fill: lighten(@school, 10);
326     }
327     [type='water'][zoom>=10] {
328       text-fill: @water * 0.6;
329       text-halo-fill: lighten(@water, 10);
330     }
331   }
332   [zoom=15][area>1600000],
333   [zoom=16][area>20000],
334   [zoom=17][area>20000],
335   [zoom=18][area>5000] {
336     text-face-name: @regular;
337     text-name: "[name]";
338     text-size: 13;
339     text-wrap-width: 60;
340     text-character-spacing: 0;
341     text-halo-radius: 2;
342   }
343   [zoom=16][area>1600000],
344   [zoom=17][area>80000],
345   [zoom=18][area>20000] {
346     text-size: 15;
347     text-character-spacing: 1;
348     text-wrap-width: 120;
349   }
350   [zoom>=17][area>1600000],
351   [zoom>=18][area>80000] {
352     text-size: 20;
353     text-character-spacing: 2;
354     text-wrap-width: 180;
355   }
356 }
357
358
359 /* ================================================================== */
360 /* WATERWAY LABELS
361 /* ================================================================== */
362
363 #waterway_label[type='river'][zoom>=13],
364 #waterway_label[type='canal'][zoom>=15],
365 #waterway_label[type='stream'][zoom>=17] {
366   text-name: '[name]';
367   text-face-name: @medium;
368   text-fill: darken(@water,20%);
369   text-halo-fill: @other_halo;
370   text-halo-radius: 1;
371   text-placement: line;
372   text-min-distance: 400;
373   text-size: 10;
374   text-dy: 7;
375   [type='river'][zoom=14],
376   [type='canal'][zoom=16],
377   [type='stream'][zoom=18] {
378     text-name: "[name].replace('([\S\ ])','$1 ')";
379   }
380   [type='river'][zoom=15],
381   [type='canal'][zoom=17] {
382     text-size: 11;
383     text-name: "[name].replace('([\S\ ])','$1 ')";
384   }
385   [type='river'][zoom>=16],
386   [type='canal'][zoom>=18] {
387     text-size: 14;
388     text-name: "[name].replace('([\S\ ])','$1 ')";
389     text-spacing: 300;
390   }
391 }
392
393 /* ================================================================== */
394 /* ROAD LABELS
395 /* ================================================================== */
396
397 #motorway_label[type='motorway'][zoom>9],
398 #motorway_label[type='trunk'][zoom>9] {
399   text-name: '[name]';
400   text-face-name: @bold;
401   text-placement: line;
402   text-fill: @road_text;
403   text-halo-fill: @road_halo;
404   text-halo-radius: 1;
405   text-min-distance: 60;
406   text-size: 11;
407   text-avoid-edges: true;
408   text-character-spacing: -0.1;
409   [zoom=11] { text-min-distance: 70; }
410   [zoom=12] { text-min-distance: 80; }
411   [zoom=13] { text-min-distance: 100; }
412 }
413
414 #mainroad_label[type='primary'][zoom>12],
415 #mainroad_label[type='secondary'][zoom>13],
416 #mainroad_label[type='tertiary'][zoom>13] {
417   text-name: '[name]';
418   text-face-name: @bold;
419   text-placement: line;
420   text-fill: @road_text;
421   text-halo-fill: @road_halo;
422   text-halo-radius: 1;
423   text-min-distance: 60;
424   text-size: 11;
425   text-avoid-edges: true;
426   text-character-spacing: -0.1;
427 }
428
429 #minorroad_label[zoom>14] {
430   text-name: '[name]';
431   text-face-name: @bold;
432   text-placement: line;
433   text-fill: @road_text;
434   text-halo-fill: @road_halo;
435   text-halo-radius: 1;
436   text-min-distance: 60;
437   text-size: 11;
438   text-avoid-edges: true;
439   // text-character-spacing: -0.5;
440 }
441
442 /* ================================================================== */
443 /* ONE-WAY ARROWS
444 /* ================================================================== */
445
446 #motorway_label[oneway!='no'][zoom>=16],
447 #mainroad_label[oneway!='no'][zoom>=16],
448 #minorroad_label[oneway!='no'][zoom>=16] {
449   marker-placement:line;
450   marker-max-error: 0.5;
451   marker-spacing: 200;
452   marker-file: url('icons/oneway.svg');
453   [oneway='-1'] { marker-file: url('icons/oneway-reverse.svg'); }
454   [zoom=16] { marker-transform: "scale(0.5)"; }
455   [zoom=17] { marker-transform: "scale(0.75)"; }
456 }
457
458
459 /* ****************************************************************** */
460
461 /* ================================================================== */
462 /* ADMIN LABELS
463 /* ================================================================== */
464
465 #admin-label-1-4[zoom>=10],
466 #admin-label-5-10[zoom>=13] {
467   text-name: "'      '+[name]+'      '";
468   text-fill: @admin_2_text;
469   text-size: 10;
470   text-placement: line;
471   text-dy: -7;
472   text-face-name: @regular;
473   text-halo-radius: 2;
474   text-halo-fill: @place_halo;
475   text-min-padding: 50;
476   text-min-distance: 50;
477   text-spacing: 300;
478   text-max-char-angle-delta: 10;
479 }
480
481
482 /* ================================================================== */
483 /* HOUSENUMBERS
484 /* ================================================================== */
485
486
487 #housenumber[zoom>=17]{
488   text-name: "[housenumber]";
489   text-placement: interior;
490   text-face-name: @medium;
491   text-fill: @housenumber_text;
492   text-halo-fill: @road_halo;
493   text-halo-radius: 1;
494   text-size: 7;
495   [zoom=17][mod5='no'] {
496     text-name: "";
497   }
498   [zoom >= 18] {
499     text-size: 9;
500   }
501 }
502
503 /* ================================================================== */
504 /* NATURAL
505 /* ================================================================== */
506
507 #natural_point_label[type='bay'][zoom>=10] {
508   text-name: '[name]';
509   text-face-name: @medium;
510   text-fill: darken(@water,30%);
511   text-halo-fill: lighten(@water,10%);
512   text-halo-radius: 1;
513   text-size: 11;
514 }
515
516 #natural_point_label[type='volcano'][zoom>=13],
517 #natural_point_label[type='peak'][zoom>=13] {
518   shield-file: url('icons/natural/peak-6.png');
519   shield-name: '[name]';
520   shield-face-name: @regular;
521   shield-fill: @peak;
522   shield-size: 10;
523   shield-min-distance: 50;
524   shield-text-dy: 6;
525   shield-text-dx: 6;
526   shield-halo-fill: @other_halo;
527   shield-halo-radius: 1;
528   shield-placement-type: simple;
529   shield-placements: 'S,N,E,W';
530   shield-unlock-image: true;
531   [ele!=null] {
532     shield-name: '[name] + " (" + [ele] + ")"';
533   }
534 }