1<beginfold id='1'></beginfold id='1'>/* kate: hl CartoCSS 2 This file contains some content coming from 3 https://github.com/gravitystorm/openstreetmap-carto 4 with CC0 license. This file is just for testing 5 katepart highlighting engine. 6 <endfold id='1'>*/</endfold id='1'> 7 8#world <beginfold id='2'>{</beginfold id='2'> 9// this syntax 10polygon-opacity: 50%; 11 12// is equivalent to 13polygon-opacity: 0.5; 14<endfold id='2'>}</endfold id='2'> 15 16@admin-boundaries: #ac46ac; 17 18<beginfold id='1'></beginfold id='1'>/* For performance reasons, the admin border layers are split into three groups 19for low, middle and high zoom levels. 20For each zoomlevel, all borders come from a single attachment, to handle 21overlapping borders correctly. 22<endfold id='1'>*/</endfold id='1'> 23 24#admin-low-zoom[zoom < 11], // test 25#admin-mid-zoom[zoom >= 11][zoom < 13], 26#admin-high-zoom[zoom >= 13] <beginfold id='2'>{</beginfold id='2'> 27 [admin_level = '2'], 28 [admin_level = '3'] <beginfold id='2'>{</beginfold id='2'> 29 [zoom >= 4] <beginfold id='2'>{</beginfold id='2'> 30 background/line-color: white; 31 background/line-width: 0.6; 32 line-color: @admin-boundaries; 33 line-width: 0.6; 34 <endfold id='2'>}</endfold id='2'> 35 [zoom >= 7] <beginfold id='2'>{</beginfold id='2'> 36 background/line-width: 2; 37 line-width: 2; 38 <endfold id='2'>}</endfold id='2'> 39 [zoom >= 10] <beginfold id='2'>{</beginfold id='2'> 40 [admin_level = '2'] <beginfold id='2'>{</beginfold id='2'> 41 background/line-width: 6; 42 line-width: 6; 43 <endfold id='2'>}</endfold id='2'> 44 [admin_level = '3'] <beginfold id='2'>{</beginfold id='2'> 45 background/line-width: 5; 46 line-width: 5; 47 line-dasharray: 4,2; 48 line-clip: false; 49 <endfold id='2'>}</endfold id='2'> 50 <endfold id='2'>}</endfold id='2'> 51 <endfold id='2'>}</endfold id='2'> 52 [admin_level = '4'] <beginfold id='2'>{</beginfold id='2'> 53 [zoom >= 4] <beginfold id='2'>{</beginfold id='2'> 54 background/line-color: white; 55 background/line-width: 0.6; 56 line-color: @admin-boundaries; 57 line-width: 0.6; 58 line-dasharray: 4,3; 59 line-clip: false; 60 <endfold id='2'>}</endfold id='2'> 61 [zoom >= 7] <beginfold id='2'>{</beginfold id='2'> 62 background/line-width: 1; 63 line-width: 1; 64 <endfold id='2'>}</endfold id='2'> 65 [zoom >= 11] <beginfold id='2'>{</beginfold id='2'> 66 background/line-width: 3; 67 line-width: 3; 68 <endfold id='2'>}</endfold id='2'> 69 <endfold id='2'>}</endfold id='2'> 70 <beginfold id='1'></beginfold id='1'>/* 71 The following code prevents admin boundaries from being rendered on top of 72 each other. Comp-op works on the entire attachment, not on the individual 73 border. Therefore, this code generates an attachment containing a set of 74 @admin-boundaries/white dashed lines (of which only the top one is visible), 75 and with `comp-op: darken` the white part is ignored, while the 76 @admin-boundaries colored part is rendered (as long as the background is not 77 darker than @admin-boundaries). 78 The SQL has `ORDER BY admin_level`, so the boundary with the lowest 79 admin_level is rendered on top, and therefore the only visible boundary. 80 <endfold id='1'>*/</endfold id='1'> 81 opacity: 0.4; 82 comp-op: darken; 83<endfold id='2'>}</endfold id='2'> 84 85#admin-mid-zoom[zoom >= 11][zoom < 13], 86#admin-high-zoom[zoom >= 13] <beginfold id='2'>{</beginfold id='2'> 87 [admin_level = '5'][zoom >= 11] <beginfold id='2'>{</beginfold id='2'> 88 background/line-color: white; 89 background/line-width: 2; 90 line-color: @admin-boundaries; 91 line-width: 2; 92 line-dasharray: 6,3,2,3,2,3; 93 line-clip: false; 94 <endfold id='2'>}</endfold id='2'> 95 [admin_level = '6'][zoom >= 11] <beginfold id='2'>{</beginfold id='2'> 96 background/line-color: white; 97 background/line-width: 2; 98 line-color: @admin-boundaries; 99 line-width: 2; 100 line-dasharray: 6,3,2,3; 101 line-clip: false; 102 <endfold id='2'>}</endfold id='2'> 103 [admin_level = '7'], 104 [admin_level = '8'] <beginfold id='2'>{</beginfold id='2'> 105 [zoom >= 12] <beginfold id='2'>{</beginfold id='2'> 106 background/line-color: white; 107 background/line-width: 1.5; 108 line-color: @admin-boundaries; 109 line-width: 1.5; 110 line-dasharray: 5,2; 111 line-clip: false; 112 <endfold id='2'>}</endfold id='2'> 113 <endfold id='2'>}</endfold id='2'> 114 opacity: 0.5; 115 comp-op: darken; 116<endfold id='2'>}</endfold id='2'> 117 118#admin-high-zoom[zoom >= 13] <beginfold id='2'>{</beginfold id='2'> 119 [admin_level = '9'], 120 [admin_level = '10'] <beginfold id='2'>{</beginfold id='2'> 121 [zoom >= 13] <beginfold id='2'>{</beginfold id='2'> 122 background/line-color: white; 123 background/line-width: 2; 124 line-color: @admin-boundaries; 125 line-width: 2; 126 line-dasharray: 2,3; 127 line-clip: false; 128 <endfold id='2'>}</endfold id='2'> 129 <endfold id='2'>}</endfold id='2'> 130 opacity: 0.5; 131 comp-op: darken; 132<endfold id='2'>}</endfold id='2'> 133 134 135 136#nature-reserve-boundaries <beginfold id='2'>{</beginfold id='2'> 137 [way_pixels > 100][zoom >= 7] <beginfold id='2'>{</beginfold id='2'> 138 [zoom < 10] <beginfold id='2'>{</beginfold id='2'> 139 ::fill <beginfold id='2'>{</beginfold id='2'> 140 opacity: 0.05; 141 polygon-fill: green; 142 <endfold id='2'>}</endfold id='2'> 143 <endfold id='2'>}</endfold id='2'> 144 a/line-width: 1; 145 a/line-offset: -0.5; 146 a/line-color: green; 147 a/line-opacity: 0.15; 148 a/line-join: round; 149 a/line-cap: round; 150 b/line-width: 2; 151 b/line-offset: -1; 152 b/line-color: green; 153 b/line-opacity: 0.15; 154 b/line-join: round; 155 b/line-cap: round; 156 [zoom >= 10] <beginfold id='2'>{</beginfold id='2'> 157 a/line-width: 2; 158 a/line-offset: -1; 159 b/line-width: 4; 160 b/line-offset: -2; 161 <endfold id='2'>}</endfold id='2'> 162 [zoom >= 14] <beginfold id='2'>{</beginfold id='2'> 163 b/line-width: 6; 164 b/line-offset: -3; 165 <endfold id='2'>}</endfold id='2'> 166 <endfold id='2'>}</endfold id='2'> 167<endfold id='2'>}</endfold id='2'> 168 169#building-text <beginfold id='2'>{</beginfold id='2'> 170[zoom >= 14][way_pixels > 3000], 171[zoom >= 17] <beginfold id='2'>{</beginfold id='2'> 172text-name: "[name]"; 173text-size: 11; 174text-fill: #444; 175text-face-name: @book-fonts; 176text-halo-radius: 1; 177text-wrap-width: 20; 178text-halo-fill: rgba(255,255,255,0.5); 179text-placement: interior; 180<endfold id='2'>}</endfold id='2'> 181<endfold id='2'>}</endfold id='2'> 182 183@marina-text: #576ddf; // also swimming_pool 184@landcover-face-name: @oblique-fonts; 185@standard-wrap-width: 30; 186 187.points <beginfold id='2'>{</beginfold id='2'> 188 [feature = 'tourism_alpine_hut'][zoom >= 13] <beginfold id='2'>{</beginfold id='2'> 189 point-file: url('symbols/alpinehut.p.16.png'); 190 point-placement: interior; 191 <endfold id='2'>}</endfold id='2'> 192 <endfold id='2'>}</endfold id='2'> 193 194 [feature = 'highway_bus_stop'] <beginfold id='2'>{</beginfold id='2'> 195 [zoom >= 16] <beginfold id='2'>{</beginfold id='2'> 196 marker-file: url('symbols/square.svg'); 197 marker-fill: @transportation-icon; 198 marker-placement: interior; 199 marker-width: 6; 200 <endfold id='2'>}</endfold id='2'> 201 [zoom >= 17] <beginfold id='2'>{</beginfold id='2'> 202 marker-file: url('symbols/bus_stop.p.12.png'); 203 marker-width: 12; 204 <endfold id='2'>}</endfold id='2'> 205 <endfold id='2'>}</endfold id='2'> 206 207[feature = 'highway_primary'] <beginfold id='2'>{</beginfold id='2'> 208[zoom >= 7][zoom < 12] <beginfold id='2'>{</beginfold id='2'> 209line-width: 0.5; 210line-color: @primary-fill; 211[zoom >= 9] <beginfold id='2'>{</beginfold id='2'> line-width: 1.2; <endfold id='2'>}</endfold id='2'> 212[zoom >= 10] <beginfold id='2'>{</beginfold id='2'> line-width: 2; <endfold id='2'>}</endfold id='2'> 213[zoom >= 11] <beginfold id='2'>{</beginfold id='2'> line-width: .5; <endfold id='2'>}</endfold id='2'> 214<endfold id='2'>}</endfold id='2'> 215<endfold id='2'>}</endfold id='2'> 216 217#world <beginfold id='2'>{</beginfold id='2'> 218 // this syntax 219 polygon-opacity: 50%; // the parameter “polygon-opacity” gets the value 0.5 (expressed in %) 220 // is equivalent to 221 polygon-opacity: 0.5; 222<endfold id='2'>}</endfold id='2'> 223 224<beginfold id='1'></beginfold id='1'>/* 225Variables behave similar to C macros 226<endfold id='1'>*/</endfold id='1'> 227@lsdjkf: @sdlfkj; // this variable gets defined by the value of another variable 228@admin-boundaries: #ac46ac; // this variable gets defined by a color value 229@way_pixels: "([way_area]*pow(4,@zoom)/24505740000)"; // A rather complex variable. [way_area] marks a data field. @zoom is a special runtime value (inspite of the @ it has nothing to do with ordinary variables) 230 231<beginfold id='1'></beginfold id='1'>/* This is 232a multiline comment. 233<endfold id='1'>*/</endfold id='1'> 234 235// A single line comment 236#admin-low-zoom[zoom < 11], // A single line comment 237#admin-mid-zoom[zoom >= 11][zoom < 13] <beginfold id='2'>{</beginfold id='2'> 238 [admin_level = '2'], // Within filters, data fields like “admin_level” are referended without extra [] brackets. 239 [admin_level = '3'] <beginfold id='2'>{</beginfold id='2'> // These data fields are rendered by default in dark blue, while the data field within expression strings are rendered by default in light blue. 240 [zoom >= 4] <beginfold id='2'>{</beginfold id='2'> 241 background/line-color: white; // symbolizer named “background” 242 background/line-width: 0.6; // symbolizer named “background” 243 line-color: @admin-boundaries; // default symbolizer (without name) 244 name: [test]; // simplified reference to the data field “test” 245 name: "[test]"; // another reference to the data field “test”, this time within an expression string (by default orange) 246 name: "([way_area]*pow(4,@zoom)/24505740000)"; // a rather complex expression string that will do some math 247 name: "'Value: '[test]"; // A verbatim string (by default red) as part of an expression string 248 name: '"Value: "[test]'; // " and ' are interchangable. The outer is always the expression string and the inner the verbatim string. 249 <endfold id='2'>}</endfold id='2'> 250 <endfold id='2'>}</endfold id='2'> 251 [admin_level = '4'] <beginfold id='2'>{</beginfold id='2'> // The string '4' is red because at this position it will be interpreted as a verbatim string, not as an expression string. 252 [zoom >= 4] <beginfold id='2'>{</beginfold id='2'> 253 line-dasharray: 4,3; // parameter “line-dasharray” gets as value a list of two integers 254 line-clip: false; // parameter “line-clip” gets as value a boolean 255 <endfold id='2'>}</endfold id='2'> 256 <endfold id='2'>}</endfold id='2'> 257 comp-op: darken; // parameter “comp-op” gets as value “darken”. 258<endfold id='2'>}</endfold id='2'> 259 260.nature-reserve-boundaries <beginfold id='2'>{</beginfold id='2'> // .nature-reserve-boudaries references a class, which is similar to a layer like #building-text, so both are rendered the same way 261 [way_pixels > 100][zoom >= 7] <beginfold id='2'>{</beginfold id='2'> // Here zoom is a keyword with results in a special filter. However, all other values are interpreted as data fields. 262 [zoom < 10] <beginfold id='2'>{</beginfold id='2'> 263 ::fill <beginfold id='2'>{</beginfold id='2'> // The :: syntax defined “attachments” (a sort of sub-layer within normal layers). So “fill” is rendered by default in the same style like layer names and class names (but this can be customized). 264 opacity: 0.05; 265 // various styles to define colors (all except the color function are rendered the same way): 266 polygon-fill: white; 267 polygon-fill: #ffffff; 268 polygon-fill: #fff; 269 polygon-fill: rgba(255,255,255,1); // define a color by a speciel function 270 polygon-fill: #ffff; // invalid color value 271 text-placement: interior; // all unknown values are hightlighted as named values. 272 <endfold id='2'>}</endfold id='2'> 273 <endfold id='2'>}</endfold id='2'> 274 <endfold id='2'>}</endfold id='2'> 275<endfold id='2'>}</endfold id='2'> 276