Changes between Version 204 and Version 268 of Help/Styles/MapCSSImplementation
- Timestamp:
- (multiple changes)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v204 v268 8 8 * [wikitr:/Help/Action/Search Search dialog] 9 9 10 Consider installing the [https://marketplace.visualstudio.com/items?itemName=whammo.mapcss-syntax MapCSS Syntax Highlighter] in VS Code to add visual highlighting for MapCSS paint and validator syntax. 10 11 11 12 == General Structure == … … 20 21 set: class; 21 22 set: .class; 23 /* note that validator rules do not use the colon after set */ 22 24 } 23 25 }}} … … 66 68 67 69 === Type selector === 68 69 70 {{{#!th valign=top 70 71 '''Selector''' … … 227 228 Selectors can include a set of conditions. If any of these conditions evaluates to false, the selector doesn't match and the style rule isn't applied. 228 229 229 An '''attribute condition''' specifies a condition on a tag of an OSM object. 230 An '''attribute condition''' specifies a condition on a tag of an OSM object. 230 231 231 232 [=#condition_selector_operators] 232 {{{#!th valign=top 233 {{{#!th valign=top 233 234 '''Operator''' 234 235 }}} … … 240 241 }}} 241 242 |------------------------------------------------------------------------------- 242 {{{#!td align=center valign=top243 {{{#!td align=center valign=top 243 244 `=` 244 245 }}} 245 {{{#!td align=left valign=top246 {{{#!td align=left valign=top 246 247 Exact match of the value. 247 248 }}} 248 {{{#!td align=left valign=top249 {{{ 250 #!mapcss 251 way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ 252 node[name="My name"] /* use quotes if key or value includes spaces */ 253 node["name: ru"="Калининград"]/* use quotes if key or value includes special characters like colons or unicode characters */254 }}} 255 }}} 256 |------------------------------------------------------------------------------- 257 {{{#!td align=center valign=top249 {{{#!td align=left valign=top 250 {{{ 251 #!mapcss 252 way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ 253 node[name="My name"] /* use quotes if key or value includes spaces */ 254 node["name:pl"="Królewiec"] /* use quotes if key or value includes special characters like colons or unicode characters */ 255 }}} 256 }}} 257 |------------------------------------------------------------------------------- 258 {{{#!td align=center valign=top 258 259 `!=` 259 260 }}} 260 {{{#!td align=left valign=top261 Value not equal 262 }}} 263 {{{#!td align=left valign=top261 {{{#!td align=left valign=top 262 Value not equal 263 }}} 264 {{{#!td align=left valign=top 264 265 {{{ 265 266 #!mapcss 266 267 way[highway!=residential] 267 268 node[name!="My name"] 268 node["name: ru"!="Калининград"]269 }}} 270 }}} 271 |------------------------------------------------------------------------------- 272 {{{#!td align=center valign=top269 node["name:pl"!="Królewiec"] 270 }}} 271 }}} 272 |------------------------------------------------------------------------------- 273 {{{#!td align=center valign=top 273 274 `<`, `>`, `<=`, `>=` 274 275 }}} 275 {{{#!td align=left valign=top276 Comparis ion for numeric values.277 278 }}} 279 {{{#!td align=left valign=top276 {{{#!td align=left valign=top 277 Comparison for numeric values. 278 279 }}} 280 {{{#!td align=left valign=top 280 281 {{{ 281 282 #!mapcss 282 283 node[population >= 50000] /* population greater than or equal to 50000 */ 283 node[ele = 3000] /* elevation with exactly 3000 meters */ 284 }}} 285 }}} 286 |------------------------------------------------------------------------------- 287 {{{#!td align=center valign=top284 node[ele = 3000] /* elevation with exactly 3000 meters */ 285 }}} 286 }}} 287 |------------------------------------------------------------------------------- 288 {{{#!td align=center valign=top 288 289 `^=` 289 290 }}} 290 {{{#!td align=left valign=top291 {{{#!td align=left valign=top 291 292 Prefix match 292 293 }}} 293 {{{#!td align=left valign=top294 {{{#!td align=left valign=top 294 295 {{{ 295 296 #!mapcss … … 298 299 }}} 299 300 |------------------------------------------------------------------------------- 300 {{{#!td align=center valign=top301 {{{#!td align=center valign=top 301 302 `$=` 302 303 }}} 303 {{{#!td align=left valign=top304 {{{#!td align=left valign=top 304 305 Postfix match 305 306 }}} 306 {{{#!td align=left valign=top307 {{{#!td align=left valign=top 307 308 {{{ 308 309 #!mapcss … … 311 312 }}} 312 313 |----------------------------------------------- 313 {{{#!td align=center valign=top314 {{{#!td align=center valign=top 314 315 `*=` 315 316 }}} 316 {{{#!td align=left valign=top317 {{{#!td align=left valign=top 317 318 Substring match 318 319 }}} 319 {{{#!td align=left valign=top320 {{{#!td align=left valign=top 320 321 {{{ 321 322 #!mapcss … … 324 325 }}} 325 326 |------------------------------------------------------------------------------- 326 {{{#!td align=center valign=top327 {{{#!td align=center valign=top 327 328 `~=` 328 329 }}} 329 {{{#!td align=left valign=top330 {{{#!td align=left valign=top 330 331 List membership 331 332 }}} 332 {{{#!td align=left valign=top333 {{{ 334 #!mapcss 335 *[vending~=stamps] /* the tag value for the tag 'vending' consists of a list of ;-separated values */336 /* and one of these values is 'stamps' */337 }}} 338 }}} 339 |------------------------------------------------------------------------------- 340 {{{#!td align=center valign=top333 {{{#!td align=left valign=top 334 {{{ 335 #!mapcss 336 *[vending~=stamps] /* the tag value for the tag 'vending' consists of a list of ;-separated values */ 337 /* and one of these values is 'stamps' */ 338 }}} 339 }}} 340 |------------------------------------------------------------------------------- 341 {{{#!td align=center valign=top 341 342 `=~` 342 343 }}} 343 {{{#!td align=left valign=top344 [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match345 346 }}} 347 {{{#!td align=left valign=top344 {{{#!td align=left valign=top 345 [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match 346 347 }}} 348 {{{#!td align=left valign=top 348 349 {{{ 349 350 #!mapcss 350 351 *[name=~/^My_pattern.*/] /* the value of the tag 'name' matches with the regular expression '^My_pattern.*' */ 351 /* Note, that reqular expressions have to be enclosed in /.../ */ 352 }}} 353 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/ javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]).354 {{{ 355 #!mapcss 356 *[name =~ /^(?i)(parking)$/] /* matches parking, Parking, PARKING, PaRkInG,... */357 *[name =~ /^(?U)(\p{Lower})+$/] /* name consists of only lower case unicode characters */ 358 }}} 359 }}} 360 |------------------------------------------------------------------------------- 361 {{{#!td align=center valign=top352 /* Note, that reqular expressions have to be enclosed in /.../ */ 353 }}} 354 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]). 355 {{{ 356 #!mapcss 357 *[name =~ /^(?i)(parking)$/] /* matches parking, Parking, PARKING, PaRkInG,... */ 358 *[name =~ /^(?U)(\p{Lower})+$/] /* name consists of only lower case unicode characters */ 359 }}} 360 }}} 361 |------------------------------------------------------------------------------- 362 {{{#!td align=center valign=top 362 363 `!~` (since r6455) 363 364 }}} 364 {{{#!td align=left valign=top365 negated [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match366 367 }}} 368 {{{#!td align=left valign=top365 {{{#!td align=left valign=top 366 negated [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match 367 368 }}} 369 {{{#!td align=left valign=top 369 370 {{{ 370 371 #!mapcss … … 373 374 }}} 374 375 |------------------------------------------------------------------------------- 375 {{{#!td align=center valign=top376 {{{#!td align=center valign=top 376 377 `∈` ([https://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609) 377 378 }}} 378 {{{#!td align=left valign=top379 {{{#!td align=left valign=top 379 380 element of 380 381 381 382 Matches when an object matches the right selector(s) contains at least one element which match the left selector(s). 382 383 }}} 384 {{{#!td align=left valign=top 383 }}} 384 {{{#!td align=left valign=top 385 385 {{{ 386 386 #!mapcss … … 389 389 } 390 390 }}} 391 Finds areas with `amenity=parking` that contain at least one node or area with `amenity=parking`. 392 Since r15064 this rule produces one warning for each element on the left when there are multiple matches. 393 }}} 394 |------------------------------------------------------------------------------- 395 {{{#!td align=center valign=top 391 Finds areas with `amenity=parking` that contain at least one node or area with `amenity=parking`. Since r15064 this rule produces one warning for each element on the left when there are multiple matches. 392 }}} 393 |------------------------------------------------------------------------------- 394 {{{#!td align=center valign=top 396 395 `⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) 397 396 }}} 398 {{{#!td align=left valign=top397 {{{#!td align=left valign=top 399 398 Subset of or Equal To 400 399 401 400 Synonym for `∈`. 402 401 }}} 403 {{{#!td align=left valign=top402 {{{#!td align=left valign=top 404 403 {{{ 405 404 #!mapcss … … 411 410 }}} 412 411 |------------------------------------------------------------------------------- 413 {{{#!td align=center valign=top412 {{{#!td align=center valign=top 414 413 `⊇` ([https://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102) 415 414 }}} 416 {{{#!td align=left valign=top415 {{{#!td align=left valign=top 417 416 Superset of or Equal To 418 417 419 418 Matches when an object matches the right selector(s) and is contained in one or more elements which match the left selectors. 420 421 }}} 422 {{{#!td align=left valign=top 423 {{{ 424 #!mapcss 425 area[amenity=parking] ⊇ *[amenity=parking] 419 }}} 420 {{{#!td align=left valign=top 421 {{{ 422 #!mapcss 423 area[amenity=parking] ⊇ *[amenity=parking] 426 424 }}} 427 425 finds nodes or areas with `amenity=parking` inside areas with `amenity=parking`. Slower than `⊆` and thus not useful in validator rules, but can be useful in the search dialog. 428 429 }}} 430 |------------------------------------------------------------------------------- 431 {{{#!td align=center valign=top 426 }}} 427 |------------------------------------------------------------------------------- 428 {{{#!td align=center valign=top 432 429 `⊈` ([https://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102) 433 430 }}} 434 {{{#!td align=left valign=top431 {{{#!td align=left valign=top 435 432 Neither a Subset of nor Equal To 436 433 437 434 Matches when an object matches the right selector(s) and does not contain any element which matches the left selectors. 438 439 }}} 440 {{{#!td align=left valign=top 435 }}} 436 {{{#!td align=left valign=top 441 437 {{{ 442 438 #!mapcss 443 439 *[highway=street_lamp] ⊈ area:closed2[amenity=parking][lit=yes] 444 440 }}} 445 finds areas amenity=parking that have lit=yes but don't contain a lamp. 446 Always add `:closed2` to avoid false positives as unclosed areas never contain something. 447 }}} 448 |------------------------------------------------------------------------------- 449 {{{#!td align=center valign=top 441 finds areas amenity=parking that have lit=yes but don't contain a lamp. Always add `:closed2` to avoid false positives as unclosed areas never contain something. 442 }}} 443 |------------------------------------------------------------------------------- 444 {{{#!td align=center valign=top 450 445 `⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) 451 446 }}} 452 {{{#!td align=left valign=top447 {{{#!td align=left valign=top 453 448 Neither a Superset of nor Equal To 454 449 455 450 Matches when an object matches the right selector(s) and is not contained in any area which matches the left selectors. 456 457 }}} 458 {{{#!td align=left valign=top 451 }}} 452 {{{#!td align=left valign=top 459 453 {{{ 460 454 #!mapcss 461 455 area[landuse=residential] ⊉ *[building] 462 456 }}} 463 finds buildings which are not inside any landuse=residential area. Note that this operator is likely to produce false positives 464 when you have `landuse=residential`areas which don't match `:closed2`. 465 }}} 466 |------------------------------------------------------------------------------- 467 {{{#!td align=center valign=top 457 finds buildings which are not inside any landuse=residential area. Note that this operator is likely to produce false positives when you have `landuse=residential`areas which don't match `:closed2`. 458 }}} 459 |------------------------------------------------------------------------------- 460 {{{#!td align=center valign=top 468 461 `⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) 469 462 }}} 470 {{{#!td align=left valign=top463 {{{#!td align=left valign=top 471 464 crossing 472 473 }}} 474 {{{#!td align=left valign=top 465 }}} 466 {{{#!td align=left valign=top 475 467 {{{ 476 468 #!mapcss … … 516 508 |------------------------------------------------------------------------------- 517 509 {{{#!td align=left valign=top 518 Presence of tag by [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match (since r6547)510 Presence of tag by [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match (since r6547) 519 511 }}} 520 512 {{{#!td align=left valign=top … … 551 543 {{{ 552 544 #!mapcss 553 way[oneway?] /* matches any way with a truth value in the tag 'oneway' */545 way[oneway?] /* matches any way with a truth value in the tag 'oneway' */ 554 546 }}} 555 547 }}} … … 561 553 {{{ 562 554 #!mapcss 563 way[oneway?!] /* matches any way with a false value in the tag 'oneway' */555 way[oneway?!] /* matches any way with a false value in the tag 'oneway' */ 564 556 }}} 565 557 }}} … … 640 632 === Zoom selector === 641 633 You can decorate a type selector with a '''zoom selector'''. The zoom selector restricts the range of zoom levels at which the respective MapCSS rule is applied. 642 643 {{{#!th align=center valign=top 644 '''Example''' 645 }}} 646 {{{#!th align=center valign=top 647 '''Description''' 648 }}} 649 |------------------------------------------------------------------------------- 650 || `way|z12 {...} ` || At zoom level 12 || 651 || `way|z13-15 {...} ` || From 13 to 15 || 652 || `way|z16- {...} ` || 16 and above || 653 || `way|z-12 {...} ` || 12 and below || 654 || `way {...} ` || any zoom level || 634 ||= '''Example 1''' =||= '''Example 2''' =||= '''Example 3''' =||= '''Description''' =|| 635 || `way|z12 {...}` || `node|z12 {...}` || `node|z12[...] {...}` || At zoom level 12 || 636 || `way|z13-15 {...}` || `node|z13-15 {...}` || `way|z13-15[...] {...}` ||From 13 to 15 || 637 || `way|z16- {...}` || `node|z16- {...}` || `node|z16-[...] {...}` || 16 and above || 638 || `way|z-12 {...}` || `node|z-12 {...}` || `node|z-12[...] {...}` || 12 and below || 639 || `way {...}` || `node{...}` || `way[...] {...}` || any zoom level || 655 640 656 641 The precise definition of scale ranges for each zoom level may change in the future. By rule of thumb you can expect to be approximately at zoom level ''n'' when imagery displays slippymap tiles of level ''n''. … … 659 644 See [/doc/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.PseudoClasses.html Javadoc] for the up-to-date list of pseudo classes supported by JOSM's MapCSS implementation. 660 645 661 ||= Class =||=Description =||646 ||= '''Class''' =||= '''Description''' =|| 662 647 || `:closed` || true for ways where the first node is the same as the last and for any (completely downloaded) multipolygon relation || 663 648 || `:closed2` || same as above, but this one ignores if a multipolygon is downloaded completely (since r9099) || … … 741 726 way::A { a; } 742 727 way::B { b; } 743 way::* { c; } 728 way::* { c; } /* overrides all existing subparts */ 744 729 }}} 745 730 is equivalent to … … 748 733 way::A { a; } 749 734 way::B { b; } 750 way::A { c; } 751 way::B { c; } 735 way::A { c; } /* overrides a with c all existing subparts */ 736 way::B { c; } /* overrides b with c all existing subparts */ 752 737 }}} 753 738 And it initializes new subparts. In other words: … … 816 801 }}} 817 802 You can also negate classes. E.g. `way!.path` for all ways, which are not part of the class ''.path''. 803 804 === Classes and Layer together === 805 If you want to use layer and classes together, please note that you have to identify the class via is_prop_set. 806 807 {{{#!mapcss 808 node[railway=signal] { set sgnl; } 809 810 /* it doesn't work */ 811 node.sgnl::layer_signal_icon { z-index: 1000; ... icon: icon/signal-icon.svg; ... } 812 node.sgnl::layer_signal_text { z-index: 1010; ... text: concat("Name of signal: ", tag("ref")); ..... ) 813 814 /* use instead: is_prop_set("...", "default") */ 815 node[is_prop_set("sgnl", "default")]::layer_signal_icon { z-index: 1000; ... icon: icon/signal-icon.svg; ... } 816 node[is_prop_set("sgnl", "default")]::layer_signal_text { z-index: 1010; ... text: concat("Name of signal: ", tag("ref")); ..... ) 817 }}} 818 818 819 819 === @supports Conditional Processing === … … 1022 1022 }}} 1023 1023 1024 Settings groups are displayed as sub-menus from the style settings menu. If at least two settings belong to a group, a special "Toggle all settings" menu item allows to quickly switch on/off all settings from this group at once. Usage example: [wiki:/Styles/MapWithAI MapWithAI]. 1024 Settings groups are displayed as sub-menus from the style settings menu. If at least two settings belong to a group, a special "Toggle all settings" menu item allows to quickly switch on/off all settings from this group at once. Usage example: [wikitr:/Styles/MapWithAI MapWithAI]. 1025 1025 1026 1026 … … 1045 1045 || `icon-offset-x` || Shift the icon in horizontal direction (positive values to the right) (since r8085) || ''Number'' || 0 || 1046 1046 || `icon-offset-y` || Shift the icon in vertical direction (positive values downwards) (since r8085) || ''Number'' || 0 || 1047 || `icon-rotation` || Rotate the icon clockwise or anti clockwise (negative value)(since r8260) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); See also the functions `degree_to_radians`, `cardinal_to_radians`. || - || 1047 || `icon-rotation` || Rotate the icon clockwise or anti clockwise (negative value)(since r8260) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) \\ or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the icon in the direction of the parent way. \\ See also the functions `degree_to_radians`, `cardinal_to_radians`. \\Since version 18678 function parent_way_angle() is an alternativ to way: e.g. {{{ way > node[...]::layer_x { ... icon-rotation: parent_way_angle(); ... } }}} || - || 1048 1048 || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || `center`, `inside`, `line` || `center` || 1049 1049 || `symbol-shape` || Display a symbol at the position of the node || `square`, `circle`, `triangle`, `pentagon`, `hexagon`, `heptagon`, `octagon`, `nonagon`, `decagon` || - || … … 1054 1054 || `symbol-fill-color` || fill color for the shape || ''Color'' || `blue`, unless either `symbol-stroke-width` or `symbol-stroke-color` is set || 1055 1055 || `symbol-fill-opacity` || fill opacity || ''Opacity'' || 1.0 || 1056 || `text-...`, `font-...` |||||| general text & font properties || 1057 || `text-anchor-horizontal` || horizontal text label placement || `left`, `center`, `right` || `right` || 1058 || `text-anchor-vertical` || vertical text label placement || `above`, `top`, `center`, `bottom`, `below` || `bottom` || 1059 || `text-rotation` || Rotate the text clockwise or anti clockwise (negative value) (since r16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); See also the functions `degree_to_radians`, `cardinal_to_radians`. (Note that the direction means where the upper edge of the text faces. That means with the default direction of north the text flows to east (with a left to right language). So if you want to flow it to e.g. south you need to set east.) || - || 1056 || `text-...`, `font-...` |||||| see general '''Text & Font properties''' || 1060 1057 1061 1058 Do not rely on the default values for `symbol-...` properties (except for `opacity`). They are intended for "quick & dirty" style sheets and should be set to an explicit value. 1062 1059 1063 === Line styles === 1060 === Line styles ===#LineStyles 1064 1061 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1065 1062 || `width` || Line width || ''Width'' || - || 1066 || `color` || Line color || ''Color'' || value of `fill-color` or (if unset) JOSM's default untagged color (`#808080`) ||1063 || `color` || Line color || ''Color'' || value of `fill-color` or\\(if unset) JOSM's default \\untagged color (`#808080`) || 1067 1064 || `opacity` || How transparent the line is. || ''Opacity'' || 1.0 || 1068 1065 || `dashes` || An array of alternating on/off lengths || list of numbers, e.g. \\> 15, 5 \\ \\may be written as expression: \\ > `list(3, 4, 5, 6)` \\ \\or the keyword `none` \\to turn dashes off || - || … … 1072 1069 || `linecap` || Shape at the end of the line (see [https://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty here]) || `none`, `round`, `square` || `none` || 1073 1070 || `linejoin` || Shape at the line corners || `round`, `miter`, `bevel` || `round` || 1074 || `miterlimit` || Applies for `linejoin: miter`. Sets the maximum overshoot when line segments meet at a very small angle || ''Number'' (>= 1.0) || 10.0 || 1075 || `offset` || Move line to the left or right (when looking in way direction). This could be used to draw multiple lanes for one way or mark left and right side of a way differently. || ''Number'' (positive value moves line to the left, negative to the right) || 0 ||1071 || `miterlimit` || Applies for `linejoin: miter`. \\Sets the maximum overshoot when line segments meet at a very small angle || ''Number'' (>= 1.0) || 10.0 || 1072 || `offset` || Move line to the left or right (when looking in way direction). \\This could be used to draw multiple lanes for one way or mark left and right side of a way differently. || ''Number'' (positive value moves line to the left,\\negative to the right) || 0 || 1076 1073 || `text-position` || set to `line`, if text should be drawn along the line || `line`, `center` || - || 1077 || `text-...`, `font-...` |||||| generaltext & font properties ||1074 || `text-...`,\\`font-...` |||||| see general '''Text & Font properties || 1078 1075 || `repeat-image` || repeated image along a line ''(since r5801)'' || ''Image'' || - || 1079 1076 || `repeat-image-width` || Width of the image (optional, see `icon-width`) ''(since r5811)'' || ''Number'' || - || 1080 1077 || `repeat-image-height` || Height of the image (optional) ''(since r5811)'' || ''Number'' || - || 1081 || `repeat-image-align` || Alignment of the image. Top-, bottom edge or the (horizontal) center line of the image will be along the line ''(since r5801)'' || `top`, `center`, `bottom` || `center` ||1078 || `repeat-image-align` || Alignment of the image.\\Top-, bottom edge or the (horizontal) center line of the image will be along the line ''(since r5801)'' || `top`, `center`, `bottom` || `center` || 1082 1079 || `repeat-image-offset` || Offset from the line ''(since r5801)'' || ''Number'' || 0 || 1083 1080 || `repeat-image-spacing` || Spacing between repeated images ''(since r5801)'' || ''Number'' || 0 || … … 1087 1084 All these properties (except for `text-...` and `font-...`) exist also with the `casing-` prefix. The casing is a second independent line element, that is drawn below the normal line and can be used to draw a thin frame around the line in another color. 1088 1085 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1089 || `casing-width` || Width of the border on both sides of the main line. In JOSM < 5214: Total width of the casing || ''Width'' (revers to `width` if relative width is specified) || - || 1090 || `casing-color` || Casing color || ''Color'' || value of `fill-color` or (if unset) JOSM's default untagged color (`#808080`) || 1086 || `casing-width` || Width of the border on both sides of the main line. \\In JOSM < 5214: Total width of the casing || ''Width'' (revers to `width` if relative width is specified) || - || 1087 || `casing-color` || Casing color || ''Color'' || value of `fill-color` or (if unset) \\JOSM's default untagged color (`#808080`) || 1091 1088 || `casing-opacity` || How transparent the casing is. || ''Opacity'' || 1.0 || 1092 1089 || `casing-`... || ... || ... || ... || 1093 1090 Similar to `casing-`, there is also the `left-casing-` and `right-casing-` prefix. It draws additional lines to the left and to the right of the main line. 1094 1091 1095 === Area styles === 1096 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||1092 === Area styles ===#AreaStyles 1093 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1097 1094 || `fill-color` || Color in which to fill the area. Until 11700, the alpha component was set to 50 to create a transparency effect. || ''Color'' || - || 1098 1095 || `fill-image` || Image pattern || ''Image'' || - || 1099 1096 || `fill-extent` || Set this property, to draw only the outline of the area. The number specifies, how far to fill from the border of the area towards the center. (If unset, the area will be filled completely) ''(since r9008)'' || ''Number'' || - || 1100 1097 || `fill-extent-threshold` || Set this property, to draw full area when the given percentage of coverage is reached. Can be greater than 100% as the covered area is estimated as **perimeter * extent**. || ''Number'' || - || 1101 || `fill-opacity` || How transparent the fill is; applies to both color and image || ''Opacity'' || 0.2 ''(since r11700, 1.0 before that)'' (can be changed with the `mappaint.fillalpha` and `mappaint.fill-image-alpha` preferences) || 1098 || `fill-opacity` || How transparent the fill is; applies to both color and image || ''Opacity'' || 0.2 ''(since r11700, 1.0 before that)'' \\(can be changed with the `mappaint.fillalpha` and \\`mappaint.fill-image-alpha` preferences) || 1102 1099 || `text-position` || set to `center`, if text should be drawn in the center of the area. Set to `inside` to place the text completely inside the area. ''(since r11722)'' || `line`, `center`, `inside` || - || 1103 || `text-...`, `font-...` |||||| general text & font properties || 1100 || `text-...`, `font-...` |||||| see general text & font properties || 1104 1101 Required properties to create an Area style: `fill-color` or `fill-image` 1105 1102 … … 1122 1119 }}} 1123 1120 {{{#!td align=left valign=top 1124 How to find the label text. No label is displayed, unless this instruction is present.1121 How to find the label text.\\No label is displayed, unless this instruction is present. 1125 1122 }}} 1126 1123 {{{#!td align=left valign=top 1127 1124 `auto` 1128 Derive the text automatically. The default name tags are: "`name:`"+''<LANG>'', "`name`", "`int_name`", "`ref`", "`operator`", "`brand`" and "`addr:housenumber`".1129 1130 Configure a list of tag names in the preference "`mappaint.nameOrder`" in order to change this list. (After changing the list, a restart of JOSM is required.)1125 Derive the text automatically. The default name tags are: "`name:`"+''<LANG>'', \\"`name`", "`int_name`", "`ref`", "`operator`", "`brand`" and "`addr:housenumber`". 1126 1127 Configure a list of tag names in the preference "`mappaint.nameOrder`" in order \\ to change this list. (After changing the list, a restart of JOSM is required.) 1131 1128 1132 1129 ''String'' 1133 Denotes the key of the tag whose value is used as text.1130 Denotes the key of the tag whose value is used as text. 1134 1131 1135 1132 ''Expressions'' 1136 1133 You can enter an expression to compute the text to be displayed. Examples: 1137 1134 * `eval("this is a static text")` - renderes a static text 1138 * `eval(concat(tag("first"), "-", tag("second")))` - displays the concatenated tags "first" and "second" 1135 * `eval(concat(tag("first"), "-", tag("second")))` - displays \\ the concatenated tags "first" and "second" 1139 1136 1140 1137 `""` … … 1145 1142 }}} 1146 1143 |------------------------------------------------------------------------------- 1147 || `text-color` || the text color || ''Color'' || `white` for lines and nodes, `#c0c0c0` for areas (JOSM "`text`" and "`areatext`"color preferences) ||1144 || `text-color` || the text color || ''Color'' || `white` for lines and nodes,\\`#c0c0c0` for areas \\(JOSM "`text`" and "`areatext`"\\color preferences) || 1148 1145 || `text-opacity` || how transparent the text is || ''Opacity'' || 1.0 || 1149 || `text-offset-x` || shift the text horizontally, (not supported for text along line) || ''Number'' || 0 || 1150 || `text-offset-y` (can also be written as`text-offset`) || shift the text vertically, positive values shift the text in upwards direction || ''Number'' || 0 ||1151 || `text-halo-radius` || size of text background border (to make text visible on background with a similar color) || ''Number'' || - || 1146 || `text-offset-x` || shift the text horizontally, \\(not supported for text along line) || ''Number'' || 0 || 1147 || `text-offset-y`\\(can also be written as\\`text-offset`) || shift the text vertically, positive values shift the text in upwards direction || ''Number'' || 0 || 1148 || `text-halo-radius` || size of text background border \\(to make text visible on background \\with a similar color) || ''Number'' || - || 1152 1149 || `text-halo-color` || color of the text halo || ''Color'' || complement of the text color || 1153 1150 || `text-halo-opacity` || transparency for the text halo || ''Opacity'' || 1.0 || 1154 || `font-family` || font family || ''String'' || "Droid Sans" \\(JOSM preference "mappaint.font") || 1155 || `font-size` || font size || ''Number'' || 8 \\(JOSM preference "mappaint.fontsize") || 1151 || `text-anchor-horizontal` || horizontal text label placement || `left`, `center`, `right` || `right` || 1152 || `text-anchor-vertical` || vertical text label placement || `above`, `top`, `center`, `bottom`, `below` || `bottom` || 1153 || `text-rotation` || Rotate the text clockwise or anti clockwise (negative value)\\(since r16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` \\([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); \\ or `way` to rotate the text in the direction of the parent way. \\See also the functions `degree_to_radians`, `cardinal_to_radians`. \\Since version 18678 function parent_way_angle() is an alternativ to way: e.g. {{{ way > node[...]::layer_x { ... text-rotation: parent_way_angle(); ... } }}} \\(Note that the direction means where the upper edge of the text faces.\\That means with the default direction of north the text flows to east\\(with a left to right language). \\So if you want to flow it to e.g. south you need to set east.) || - || 1154 || `text-position` |||||| see [#AreaStyles Area styles] and [#LineStyles Line styles] || 1155 || `font-family` || font family || ''String'' || "Droid Sans" \\(JOSM preference "`mappaint.font`") || 1156 || `font-size` || font size || ''Number'' || 8 \\(JOSM preference "`mappaint.fontsize`") || 1156 1157 || `font-weight` || bold or not || `bold`, `normal` || `normal` || 1157 1158 || `font-style` || italic or not || `italic`, `normal` || `normal` || … … 1177 1178 * '''`rgba(/*r*/, /*g*/, /*b*/, /*alpha*/)`''' - rgb value with alpha 1178 1179 * '''`hsb_color(/*hue*/, /*saturation*/, /*brightness*/)`''' - color from HSB color space 1180 * if the color is prefixed with a name and #, e.g. `color: highway_track#6e541c;` it will appear in the [wikitr:/Help/Preferences/ColorPreference Color Preference] and end users can adjust the color there themself 1179 1181 1180 1182 '' '''Opacity''' '' … … 1199 1201 comparison operators 1200 1202 asin, atan, atan2, ceil, cos, cosh, exp, floor, log, max, min, mod (since r17759), random, round, signum, sin, sinh, sqrt, tan, tanh:: 1201 the usual meaning, [https://do wnload.oracle.com/javase/8/docs/api/java/lang/Math.html details]1203 the usual meaning, [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html details] 1202 1204 cond(b, fst, snd):: 1203 1205 b ? fst : snd:: … … 1272 1274 return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since r6534''] 1273 1275 substring(str, start, end):: 1274 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since r6534''] 1276 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since r6534''], a negative end index counts from the string end [''since r19259''] 1275 1277 replace(string, old, new):: 1276 1278 Replaces any occurrence of the substring ''old'' within the string ''string'' with the text ''new'' … … 1297 1299 CRC32_checksum(''str''):: 1298 1300 calculate the CRC32 checksum of a string (result is an integer from 0 to 2^32^-1) [''since r6908''] 1301 siunit_length(''str''):: 1302 convert length units to meter (fault tolerant, ignoring white space) [''since r19089''] 1299 1303 is_right_hand_traffic():: 1300 1304 Check if there is left-hand or right-hand traffic at the current location. [''since r7193''] … … 1327 1331 sort(''str1'', ''str2'', ''str3'', ''...''):: 1328 1332 sorts an array of strings [''since r15279''] 1329 sort_list():: 1333 sort_list(''list_name''):: 1330 1334 sorts a list of strings [''since r15279''] 1331 1335 tag_regex(''regex''):: 1332 returns a list of values that match the regex [''since r15317'']1336 returns a list containing the values of keys that match the regex [''since r15317''] 1333 1337 to_boolean(''str''):: 1334 1338 returns the string argument as a boolean [''since r16110''] … … 1347 1351 uniq(''str1'', ''str2'', ''str3'', ''...''):: 1348 1352 returns a list of strings that only have unique values from an array of strings [''since r15323''] 1349 uniq_list():: 1350 returns a list of strings that only have unique values from a list of strings [''since r15353''] 1353 uniq_list(''list_name''):: 1354 returns a list of strings that only have unique values from a list of strings [''since r15323''] 1355 parent_way_angle():: 1356 returns the angle of the parent way as a double in rad [''since r18664''] (see: text-rotation or icon-rotation) 1357 convert_primitive_to_string(''PrimitiveId''):: 1358 returns the primitive id as a string [''since r18829''] 1359 convert_primitives_to_string(''PrimitiveId'', ''PrimitiveId'', ''...''):: 1360 returns a list of primitive ids converted to strings [''since r18829''] 1361 parent_osm_primitives(''optional key'', ''optional value''):: 1362 returns a list of primitive ids which match the key and value (if present) [''since r18829''] 1351 1363 1352 1364 === Examples === … … 1426 1438 }}} 1427 1439 1440 * case insensitive selector. This matches: `Name=Main Street`, but also `naMe=MAIN STREET` 1441 {{{ 1442 #!mapcss 1443 way[/(?i)^name$/ =~ /(?i)^Main Street$/] { 1444 } 1445 }}} 1446 1428 1447 1429 1448 == Compatibility notes ==
