Changes between Version 199 and Version 268 of Help/Styles/MapCSSImplementation
- Timestamp:
- (multiple changes)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v199 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 243 {{{#!td align=center valign=top 243 244 `=` 244 245 }}} 245 {{{#!td align=left 246 {{{#!td align=left valign=top 246 247 Exact match of the value. 247 248 }}} 248 {{{#!td align=left 249 {{{ 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 249 {{{#!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 261 Value not equal 262 }}} 263 {{{#!td align=left 261 {{{#!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 269 node["name:pl"!="Królewiec"] 270 }}} 271 }}} 272 |------------------------------------------------------------------------------- 273 {{{#!td align=center valign=top 273 274 `<`, `>`, `<=`, `>=` 274 275 }}} 275 {{{#!td align=left 276 Comparis ion for numeric values.277 278 }}} 279 {{{#!td align=left 276 {{{#!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 284 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 291 {{{#!td align=left valign=top 291 292 Prefix match 292 293 }}} 293 {{{#!td align=left 294 {{{#!td align=left valign=top 294 295 {{{ 295 296 #!mapcss … … 298 299 }}} 299 300 |------------------------------------------------------------------------------- 300 {{{#!td align=center 301 {{{#!td align=center valign=top 301 302 `$=` 302 303 }}} 303 {{{#!td align=left 304 {{{#!td align=left valign=top 304 305 Postfix match 305 306 }}} 306 {{{#!td align=left 307 {{{#!td align=left valign=top 307 308 {{{ 308 309 #!mapcss … … 311 312 }}} 312 313 |----------------------------------------------- 313 {{{#!td align=center 314 {{{#!td align=center valign=top 314 315 `*=` 315 316 }}} 316 {{{#!td align=left 317 {{{#!td align=left valign=top 317 318 Substring match 318 319 }}} 319 {{{#!td align=left 320 {{{#!td align=left valign=top 320 321 {{{ 321 322 #!mapcss … … 324 325 }}} 325 326 |------------------------------------------------------------------------------- 326 {{{#!td align=center 327 {{{#!td align=center valign=top 327 328 `~=` 328 329 }}} 329 {{{#!td align=left 330 {{{#!td align=left valign=top 330 331 List membership 331 332 }}} 332 {{{#!td align=left 333 {{{ 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 333 {{{#!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 344 [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match345 346 }}} 347 {{{#!td align=left 344 {{{#!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 352 /* 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 365 negated [https://do wnload.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match366 367 }}} 368 {{{#!td align=left 365 {{{#!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 376 {{{#!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 379 {{{#!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 397 {{{#!td align=left valign=top 399 398 Subset of or Equal To 400 399 401 400 Synonym for `∈`. 402 401 }}} 403 {{{#!td align=left 402 {{{#!td align=left valign=top 404 403 {{{ 405 404 #!mapcss … … 411 410 }}} 412 411 |------------------------------------------------------------------------------- 413 {{{#!td align=center 412 {{{#!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 415 {{{#!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 431 {{{#!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 447 {{{#!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 463 {{{#!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) || … … 667 652 || `:unconnected` || true for nodes that are not used by any way (since r6687) || 668 653 || `:tagged` || What JOSM considers tagged, i.e. an object that with a tag key other than the following: `source*`, `source_ref`, `note`, `comment`, `converted_by`, `created_by`, `watch*`, `fixme`, `FIXME`, `description`, `attribution` (version r4008; in this list, `*` is a glob) 654 || `:area-style` || true if the object has an area style || 669 655 || `:righthandtraffic` || true if there is right-hand traffic at the current location (since r7193); see [wikitr:/left-right-hand-traffic left-right-hand-traffic] for screenshot of areas || 670 656 || `:clockwise` || Whether the way is closed and oriented clockwise, or non-closed and the 1st, 2nd and last node are in clockwise order. || … … 674 660 || `:in-downloaded-area` || true if an object is within source area and false if in the hatched area (since r8495). || 675 661 || `:selected` || true if an object is selected in the editor (since r9341). || 662 || `:highlighted` || true if the object is highlighted || 676 663 || `:modified` || changed and new objects (since r7193). || 677 664 You can also negate pseudo classes. E.g. `!:new` for all old objects. … … 739 726 way::A { a; } 740 727 way::B { b; } 741 way::* { c; } 728 way::* { c; } /* overrides all existing subparts */ 742 729 }}} 743 730 is equivalent to … … 746 733 way::A { a; } 747 734 way::B { b; } 748 way::A { c; } 749 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 */ 750 737 }}} 751 738 And it initializes new subparts. In other words: … … 814 801 }}} 815 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 }}} 816 818 817 819 === @supports Conditional Processing === … … 1020 1022 }}} 1021 1023 1022 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]. 1023 1025 1024 1026 … … 1043 1045 || `icon-offset-x` || Shift the icon in horizontal direction (positive values to the right) (since r8085) || ''Number'' || 0 || 1044 1046 || `icon-offset-y` || Shift the icon in vertical direction (positive values downwards) (since r8085) || ''Number'' || 0 || 1045 || `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(); ... } }}} || - || 1046 1048 || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || `center`, `inside`, `line` || `center` || 1047 1049 || `symbol-shape` || Display a symbol at the position of the node || `square`, `circle`, `triangle`, `pentagon`, `hexagon`, `heptagon`, `octagon`, `nonagon`, `decagon` || - || … … 1052 1054 || `symbol-fill-color` || fill color for the shape || ''Color'' || `blue`, unless either `symbol-stroke-width` or `symbol-stroke-color` is set || 1053 1055 || `symbol-fill-opacity` || fill opacity || ''Opacity'' || 1.0 || 1054 || `text-...`, `font-...` |||||| general text & font properties || 1055 || `text-anchor-horizontal` || horizontal text label placement || `left`, `center`, `right` || `right` || 1056 || `text-anchor-vertical` || vertical text label placement || `above`, `top`, `center`, `bottom`, `below` || `bottom` || 1057 || `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''' || 1058 1057 1059 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. 1060 1059 1061 === Line styles === 1060 === Line styles ===#LineStyles 1062 1061 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1063 1062 || `width` || Line width || ''Width'' || - || 1064 || `color` || Line color || ''Color'' || value of `fill-color` or 1063 || `color` || Line color || ''Color'' || value of `fill-color` or\\(if unset) JOSM's default \\untagged color (`#808080`) || 1065 1064 || `opacity` || How transparent the line is. || ''Opacity'' || 1.0 || 1066 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 || - || … … 1070 1069 || `linecap` || Shape at the end of the line (see [https://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty here]) || `none`, `round`, `square` || `none` || 1071 1070 || `linejoin` || Shape at the line corners || `round`, `miter`, `bevel` || `round` || 1072 || `miterlimit` || Applies for `linejoin: miter`. Sets the maximum overshoot when line segments meet at a very small angle || ''Number'' (>= 1.0) || 10.0 || 1073 || `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, 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 || 1074 1073 || `text-position` || set to `line`, if text should be drawn along the line || `line`, `center` || - || 1075 || `text-...`, text & font properties ||1074 || `text-...`,\\`font-...` |||||| see general '''Text & Font properties || 1076 1075 || `repeat-image` || repeated image along a line ''(since r5801)'' || ''Image'' || - || 1077 1076 || `repeat-image-width` || Width of the image (optional, see `icon-width`) ''(since r5811)'' || ''Number'' || - || 1078 1077 || `repeat-image-height` || Height of the image (optional) ''(since r5811)'' || ''Number'' || - || 1079 || `repeat-image-align` || Alignment of the image. 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` || 1080 1079 || `repeat-image-offset` || Offset from the line ''(since r5801)'' || ''Number'' || 0 || 1081 1080 || `repeat-image-spacing` || Spacing between repeated images ''(since r5801)'' || ''Number'' || 0 || … … 1085 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. 1086 1085 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1087 || `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) || - || 1088 || `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`) || 1089 1088 || `casing-opacity` || How transparent the casing is. || ''Opacity'' || 1.0 || 1090 1089 || `casing-`... || ... || ... || ... || 1091 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. 1092 1091 1093 === Area styles === 1094 ||= 1092 === Area styles ===#AreaStyles 1093 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1095 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'' || - || 1096 1095 || `fill-image` || Image pattern || ''Image'' || - || 1097 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'' || - || 1098 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'' || - || 1099 || `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) || 1100 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` || - || 1101 || `text-...`, `font-...` |||||| general text & font properties || 1100 || `text-...`, `font-...` |||||| see general text & font properties || 1102 1101 Required properties to create an Area style: `fill-color` or `fill-image` 1103 1102 … … 1120 1119 }}} 1121 1120 {{{#!td align=left valign=top 1122 How to find the label text. 1121 How to find the label text.\\No label is displayed, unless this instruction is present. 1123 1122 }}} 1124 1123 {{{#!td align=left valign=top 1125 1124 `auto` 1126 1127 1128 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.) 1129 1128 1130 1129 ''String'' 1131 1130 Denotes the key of the tag whose value is used as text. 1132 1131 1133 1132 ''Expressions'' 1134 1133 You can enter an expression to compute the text to be displayed. Examples: 1135 1134 * `eval("this is a static text")` - renderes a static text 1136 * `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" 1137 1136 1138 1137 `""` … … 1143 1142 }}} 1144 1143 |------------------------------------------------------------------------------- 1145 || `text-color` || the text color || ''Color'' || `white` for lines and nodes, 1144 || `text-color` || the text color || ''Color'' || `white` for lines and nodes,\\`#c0c0c0` for areas \\(JOSM "`text`" and "`areatext`"\\color preferences) || 1146 1145 || `text-opacity` || how transparent the text is || ''Opacity'' || 1.0 || 1147 || `text-offset-x` || shift the text horizontally, (not supported for text along line) || ''Number'' || 0 || 1148 || `text-offset-y` 1149 || `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'' || - || 1150 1149 || `text-halo-color` || color of the text halo || ''Color'' || complement of the text color || 1151 1150 || `text-halo-opacity` || transparency for the text halo || ''Opacity'' || 1.0 || 1152 || `font-family` || font family || ''String'' || "Droid Sans" \\(JOSM preference "mappaint.font") || 1153 || `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`") || 1154 1157 || `font-weight` || bold or not || `bold`, `normal` || `normal` || 1155 1158 || `font-style` || italic or not || `italic`, `normal` || `normal` || … … 1159 1162 * In [wikitr:/Rules Validator rules] they must be prefixed by a `-`, e.g.: `-osmoseItemClassLevel: "1210/1/1";` 1160 1163 1161 === Property values explanations === 1164 === Property values explanations === #Propertyvaluesexplanations 1162 1165 '' '''Width''' '' 1163 1166 - 14.0 (any positive number) … … 1175 1178 * '''`rgba(/*r*/, /*g*/, /*b*/, /*alpha*/)`''' - rgb value with alpha 1176 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 1177 1181 1178 1182 '' '''Opacity''' '' … … 1197 1201 comparison operators 1198 1202 asin, atan, atan2, ceil, cos, cosh, exp, floor, log, max, min, mod (since r17759), random, round, signum, sin, sinh, sqrt, tan, tanh:: 1199 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] 1200 1204 cond(b, fst, snd):: 1201 1205 b ? fst : snd:: … … 1242 1246 assemble the strings to one 1243 1247 join(''sep'', ''str1'', ''str2'', ...):: 1244 join strings, w hith ''sep'' as separator [''since r6737'']1248 join strings, with ''sep'' as separator [''since r6737''] 1245 1249 join_list(''sep'', ''list_name''):: 1246 1250 joins the elements of the list ''list_name'' to one string separated by the separator ''sep'' [''since r8775''] … … 1270 1274 return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since r6534''] 1271 1275 substring(str, start, end):: 1272 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''] 1273 1277 replace(string, old, new):: 1274 1278 Replaces any occurrence of the substring ''old'' within the string ''string'' with the text ''new'' … … 1295 1299 CRC32_checksum(''str''):: 1296 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''] 1297 1303 is_right_hand_traffic():: 1298 1304 Check if there is left-hand or right-hand traffic at the current location. [''since r7193''] … … 1325 1331 sort(''str1'', ''str2'', ''str3'', ''...''):: 1326 1332 sorts an array of strings [''since r15279''] 1327 sort_list():: 1333 sort_list(''list_name''):: 1328 1334 sorts a list of strings [''since r15279''] 1329 1335 tag_regex(''regex''):: 1330 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''] 1331 1337 to_boolean(''str''):: 1332 1338 returns the string argument as a boolean [''since r16110''] … … 1345 1351 uniq(''str1'', ''str2'', ''str3'', ''...''):: 1346 1352 returns a list of strings that only have unique values from an array of strings [''since r15323''] 1347 uniq_list():: 1348 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''] 1349 1363 1350 1364 === Examples === … … 1406 1420 }}} 1407 1421 1422 * casing on inside of area 1423 {{{ 1424 #!mapcss 1425 area[building]:clockwise { 1426 right-casing-width: 10; 1427 } 1428 area[building]:anticlockwise { 1429 left-casing-width: 10; 1430 } 1431 /* or */ 1432 area[building][is_clockwise()] { 1433 right-casing-width: 10; 1434 } 1435 area[building][is_anticlockwise()] { 1436 left-casing-width: 10; 1437 } 1438 }}} 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 1408 1447 1409 1448 == Compatibility notes ==