Changes between Version 112 and Version 268 of Help/Styles/MapCSSImplementation


Ignore:
Timestamp:
(multiple changes)
Author:
(multiple changes)
Comment:
(multiple changes)

Legend:

Unmodified
Added
Removed
Modified
  • Help/Styles/MapCSSImplementation

    v112 v268  
    11[[TranslatedPages]]
    2 [[PageOutline(1-10,Table of Contents)]]
    3 This page documents details on JOSM's [osmwiki:MapCSS/0.2 MapCSS] implementation.
     2[[PageOutline(2-10,Table of Contents)]]
     3= MapCSS Implementation=
     4JOSM's implementation of [osmwiki:MapCSS/0.2 MapCSS] is used for the features:
     5
     6* [wikitr:/Styles Mappaint styles]
     7* [wikitr:/Rules Validator rules], see [wikitr:/Help/Validator/MapCSSTagChecker MapCSS tag checker] for the special part for rules only.
     8* [wikitr:/Help/Action/Search Search dialog]
     9
     10Consider 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.
    411
    512== General Structure ==
     
    1421    set: class;
    1522    set: .class;
     23    /* note that validator rules do not use the colon after set */
    1624}
    1725}}}
     
    3341}}}
    3442
    35 == Selectors ==
    36 ''Selectors'' denote the filter expressions of a MapCSS rule. The rule is only applied to a map object, if its selectors match
    37 with the object.
    38 
    39 Selectors in MapCSS are different from standard CSS for the web. MapCSS only supports a subset of the standard CSS selectors, but
    40 extends them with additional selectors required for OSM data.
     43
     44== Selectors == #Selectors
     45''Selectors'' denote the filter expressions of a MapCSS rule. The rule is only applied to a map object, if its selectors match with the object.
     46
     47Selectors in MapCSS are different from standard CSS for the web. MapCSS only supports a subset of the standard CSS selectors, but extends them with additional selectors required for OSM data.
    4148
    4249Some basic examples:
     
    4653way[highway=residential] {  /*  the styles */}
    4754
    48 /* applied to new, closed ways on layer 1, provided they have the tag amenity=parking and access=public, and provided
     55/* applied to new, closed ways on layer 1, provided they have the tag amenity=parking and access=customers, and provided
    4956 * the zoom level is between 11 and 14
    5057 */
    51 way|z11-14[amenity=parking][access=public]:closed:new::layer_1 {...}
    52 
    53 
    54 area[amenity=parking][access=public], area[amenity=parking][!access] {...}
     58way|z11-14[amenity=parking][access=customers]:closed:new::layer_1 {...}
     59
     60
     61area[amenity=parking][access=customers], area[amenity=parking][!access] {...}
    5562relation[type=route][route=foot] > way::relation_underlay {..}
    5663}}}
     
    6168
    6269=== Type selector ===
    63 
    64 {{{#!th align=left valign=top
     70{{{#!th valign=top
    6571'''Selector'''
    6672}}}
    67 {{{#!th align=left valign=top
     73{{{#!th valign=top
    6874'''Description'''
    6975}}}
    7076|-------------------------------------------------------------------------------
    71 {{{#!td align=left  valign=top
     77{{{#!td align=center  valign=top
    7278*
    7379}}}
     
    7682}}}
    7783|-------------------------------------------------------------------------------
    78 {{{#!td align=left  valign=top
    79 {{{node}}}, {{{way}}}, {{{relation}}}
     84{{{#!td align=center  valign=top
     85`node`, `way`, `relation`
    8086}}}
    8187{{{#!td align=left  valign=top   
     
    8389}}}
    8490|-------------------------------------------------------------------------------
    85 {{{#!td align=left  valign=top
    86 {{{area}}}
     91{{{#!td align=center  valign=top
     92`area`
    8793}}}
    8894{{{#!td align=left  valign=top   
     
    94100way[natural=beach], relation[type=multipolygon][natural=beach] {...}
    95101}}}
    96 Note that {{{area}}} selects unclosed ways as well, so it may be useful to add the {{{:closed}}} pseudo class. The JOSM Validator will give a warning for unclosed ways that have an area style.
    97 }}}
    98 |-------------------------------------------------------------------------------
    99 {{{#!td align=left  valign=top
    100 {{{meta}}}
     102Note that `area` selects unclosed ways as well, so it may be useful to add the `:closed` pseudo class. The JOSM Validator will give a warning for unclosed ways that have an area style.
     103}}}
     104|-------------------------------------------------------------------------------
     105{{{#!td align=center  valign=top
     106`meta`
    101107}}}
    102108{{{#!td align=left  valign=top   
    103 The {{{meta}}} selector starts a special rule that should stand at the beginning of the file. It gives some general information on the style sheet. All software that supports MapCSS should be able to parse this sections without errors, so do not use exotic syntax extensions in this part.
     109The `meta` selector starts a special rule that should stand at the beginning of the file. It gives some general information on the style sheet. All software that supports MapCSS should be able to parse this sections without errors, so do not use exotic syntax extensions in this part.
    104110{{{
    105111#!mapcss
    106112meta {
    107113    title: "Parking lanes";   /* title shown in the menu */
    108     icon: "images/logo.png"; /* small icon shown in the menu next to the title */
     114    icon: "logo_16x16x8.png"; /* small icon shown in the menu next to the title */
    109115    version: "1.2";           /* the version of the style */
    110116    description: "...";       /* one or two sentences of describing the style */
    111117    author: "...";            /* the author(s) of the style */
    112     link: "http://...";       /* URL to the web page of the style */
     118    link: "https://...";      /* URL to the web page of the style */
    113119    min-josm-version: 6789;   /* the minimum JOSM version where this style works */
    114120}
     
    116122}}}
    117123|-------------------------------------------------------------------------------
    118 {{{#!td align=left  valign=top
    119 {{{canvas}}}
     124{{{#!td align=center  valign=top
     125`canvas`
    120126}}}
    121127{{{#!td align=left  valign=top   
     
    142148}}}
    143149|-
    144 {{{#!td
    145 {{{fill-color}}}
     150{{{#!td align=center
     151`fill-color`
    146152}}}
    147153{{{#!td
    148154Specifies the overall fill/background color (`background-color` is deprecated since r7110).
    149155}}}
    150 {{{#!td
     156{{{#!td align=center
    151157''Color''
    152158}}}
    153159{{{#!td align=center
    154 {{{black}}}
     160`black`
    155161}}}
    156162|-
    157 {{{#!td
    158 {{{default-points}}}
     163{{{#!td align=center
     164`default-points`
    159165}}}
    160166{{{#!td
    161167Whether default point style should be added to nodes where no style applies.
    162168}}}
    163 {{{#!td
     169{{{#!td align=center
    164170''Boolean''
    165171}}}
    166172{{{#!td align=center
    167 {{{true}}}
     173`true`
    168174}}}
    169175|-
    170 {{{#!td
    171 {{{default-lines}}}
     176{{{#!td align=center
     177`default-lines`
    172178}}}
    173179{{{#!td
    174180Whether default line style should be added to ways where no style applies.
    175181}}}
    176 {{{#!td
     182{{{#!td align=center
    177183''Boolean''
    178184}}}
    179185{{{#!td align=center
    180 {{{true}}}
     186`true`
    181187}}}
    182188}}}
    183189
    184190=== Child selector ===
    185 If a node is part of a way, we say that it is a ''child'' of this way. Similarly, if a node, a way, or a relation is a member
    186 of a relation, we say, that it is a ''child'' of this relation.
     191If a node is part of a way, we say that it is a ''child'' of this way. Similarly, if a node, a way, or a relation is a member of a relation, we say, that it is a ''child'' of this relation.
    187192
    188193In MapCSS you can use a '''child selector''' which matches only if both the parent and the child object match.
     
    202207* The functions ''prop()'' and ''is_prop_set()'' are only supported on the right side of the > sign.
    203208* The functions ''parent_tag'' and ''parent_tags'' (see below) can be used to access tags from the parent(s).
    204 * For compatibility with the MapCSS 0.2 standard, `relation[type=route][route=foot] way {/*...*/}`, without the greather-than-sign `>` is supported, too. However, no [[#Linkselector]] may be specified in this case.
    205 
     209* For compatibility with the MapCSS 0.2 standard, `relation[type=route][route=foot] way {/*...*/}`, without the greater-than-sign `>` is supported, too. However, no [#LinkSelector Link selector] may be specified in this case.
    206210
    207211=== Parent selector ===
    208 In addition to child selectors, JOSMs supports the the notion of a '''parent selector'''. Note, that parent selectors are a
    209 JOSM-specific extension of MapCSS not present in other MapCSS implementations.
    210 
    211 Similar to a child selector, a parent selector only matches if both the parent and the child object match. In contrast to
    212 to the child selector, the character < is used.
    213 
    214 In contrast to the child selector, the parent object will be "selected". In other words, the properties in the {{{{...}}}}-Declaration Block apply to the object on the right hand side of the "<" sign.
     212In addition to child selectors, JOSM supports the notion of a '''parent selector'''. Note, that parent selectors are a JOSM-specific extension of MapCSS not present in other MapCSS implementations.
     213
     214Similar to a child selector, a parent selector only matches if both the parent and the child object match. In contrast to the child selector, the character < is used.
     215
     216In contrast to the child selector, the parent object will be "selected". In other words, the properties in the `{{{...}}}`-Declaration Block apply to the object on the right hand side of the "<" sign.
    215217
    216218Example:
     
    224226
    225227=== Condition selector ===
    226 Selectors can include a set of conditions. If any of these conditions evaluates to false, the selector doesn't match and the style
    227 rule isn't applied.
    228 
    229 An '''attribute condition''' specifies a condition on a tag of an OSM object.
     228Selectors 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.
     229
     230An '''attribute condition''' specifies a condition on a tag of an OSM object.
    230231
    231232[=#condition_selector_operators]
    232 {{{#!th align=left valign=top 
     233{{{#!th valign=top
    233234'''Operator'''
    234235}}}
    235 {{{#!th align=left valign=top
     236{{{#!th valign=top
    236237'''Description'''
    237238}}}
    238 {{{#!th align=left valign=top
     239{{{#!th valign=top
    239240'''Example'''
    240241}}}
    241242|-------------------------------------------------------------------------------
    242 {{{#!td align=left valign=top
     243{{{#!td align=center valign=top
    243244`=`
    244245}}}
    245 {{{#!td align=left  valign=top   
     246{{{#!td align=left valign=top
    246247Exact match of the value.
    247248}}}
    248 {{{#!td align=left  valign=top   
    249 {{{
    250 #!mapcss
    251 way[highway=residential]                   /* without quotes always case insensitive */
    252 node[name="My name"]                       /* use quotes for if value includes spaces or if case sensitive matching is important */
    253 node["MY_Special_TAG"="another value"]     /* use quotes for tag names if case sensitive matching is required */
    254 node["ÖPVN"=tram]                          /* use quotes for tag keys with special characters */
    255                                            /*   note that these are not common in OSM at the moment */
    256 }}}
    257 }}}
    258 |-------------------------------------------------------------------------------
    259 {{{#!td align=left  valign=top
     249{{{#!td align=left valign=top
     250{{{
     251#!mapcss
     252way[highway=residential]                    /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential   */
     253node[name="My name"]                        /* use quotes if key or value includes spaces                                               */
     254node["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
    260259`!=`
    261260}}}
    262 {{{#!td align=left  valign=top   
    263 Value not equal
    264 }}}
    265 {{{#!td align=left  valign=top   
    266 {{{
    267 #!mapcss
    268 way[highway!=residential]                   /* without quotes always case insensitive */
    269 node[name!="My name"]                       /* use quotes if value includes spaces or if case sensitive matching is important */
    270 node["MY_Special_TAG"!="another value"]     /* use quotes for tag names if case sensitive matching is required */
    271 node["name:fr"!="mon nome"]                 /* use quotes for tag names with special characters like colons*/
    272 }}}
    273 }}}
    274 |-------------------------------------------------------------------------------
    275 {{{#!td align=left  valign=top
     261{{{#!td align=left valign=top
     262Value not equal
     263}}}
     264{{{#!td align=left valign=top
     265{{{
     266#!mapcss
     267way[highway!=residential]
     268node[name!="My name"]
     269node["name:pl"!="Królewiec"]
     270}}}
     271}}}
     272|-------------------------------------------------------------------------------
     273{{{#!td align=center valign=top
    276274`<`, `>`, `<=`, `>=`
    277275}}}
    278 {{{#!td align=left  valign=top   
    279 Comparision for numeric values.
    280 
    281 }}}
    282 {{{#!td align=left  valign=top   
     276{{{#!td align=left valign=top
     277Comparison for numeric values.
     278
     279}}}
     280{{{#!td align=left valign=top
    283281{{{
    284282#!mapcss
    285283node[population >= 50000]                   /* population greater than or equal to 50000 */
    286 node[ele = 3000]                            /* elevation with exactly 3000 meters */
    287 }}}
    288 }}}
    289 |-------------------------------------------------------------------------------
    290 {{{#!td align=left valign=top
    291 {{{^=}}}
    292 }}}
    293 {{{#!td align=left  valign=top   
     284node[ele = 3000]                            /* elevation with exactly 3000 meters        */
     285}}}
     286}}}
     287|-------------------------------------------------------------------------------
     288{{{#!td align=center valign=top
     289`^=`
     290}}}
     291{{{#!td align=left valign=top
    294292Prefix match
    295293}}}
    296 {{{#!td align=left  valign=top   
     294{{{#!td align=left valign=top
    297295{{{
    298296#!mapcss
     
    301299}}}
    302300|-------------------------------------------------------------------------------
    303 {{{#!td align=left valign=top
     301{{{#!td align=center valign=top
    304302`$=`
    305303}}}
    306 {{{#!td align=left  valign=top   
     304{{{#!td align=left valign=top
    307305Postfix match
    308306}}}
    309 {{{#!td align=left  valign=top   
     307{{{#!td align=left valign=top
    310308{{{
    311309#!mapcss
     
    314312}}}
    315313|-----------------------------------------------
    316 {{{#!td align=left valign=top
     314{{{#!td align=center valign=top
    317315`*=`
    318316}}}
    319 {{{#!td align=left  valign=top   
     317{{{#!td align=left valign=top
    320318Substring match
    321319}}}
    322 {{{#!td align=left  valign=top   
     320{{{#!td align=left valign=top
    323321{{{
    324322#!mapcss
     
    327325}}}
    328326|-------------------------------------------------------------------------------
    329 {{{#!td align=left valign=top
     327{{{#!td align=center valign=top
    330328`~=`
    331329}}}
    332 {{{#!td align=left  valign=top   
     330{{{#!td align=left valign=top
    333331List membership
    334332}}}
    335 {{{#!td align=left  valign=top   
    336 {{{
    337 #!mapcss
    338 *[vending~=stamps]                          /* the tag value for the tag 'vending' consists of a list of ;-separated values    */
    339                                             /* and one of these values is 'stamps'                                             */
    340 }}}
    341 }}}
    342 |-------------------------------------------------------------------------------
    343 {{{#!td align=left valign=top
     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
    344342`=~`
    345343}}}
    346 {{{#!td align=left  valign=top   
    347 [http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum Regular expression] match
    348 
    349 }}}
    350 {{{#!td align=left  valign=top   
     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
    351349{{{
    352350#!mapcss
    353351*[name=~/^My_pattern.*/]                    /* the value of the tag 'name' matches with the regular expression '^My_pattern.*' */
    354                                             /* Note, that reqular expressions have to be enclosed in /.../                     */                 
    355 }}}
    356 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]).
    357 {{{
    358 #!mapcss
    359 *[name =~ /^(?U)(\p{Lower})+$/]              /* name consists of only lower case unicode characters */                 
    360 }}}
    361 }}}
    362 |-------------------------------------------------------------------------------
    363 {{{#!td align=left  valign=top
     352                                            /* Note, that reqular expressions have to be enclosed in /.../                     */
     353}}}
     354Case-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
    364363`!~` (since r6455)
    365364}}}
    366 {{{#!td align=left  valign=top   
    367 negated [http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum Regular expression] match
    368 
    369 }}}
    370 {{{#!td align=left  valign=top   
     365{{{#!td align=left valign=top
     366negated [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
    371370{{{
    372371#!mapcss
     
    375374}}}
    376375|-------------------------------------------------------------------------------
    377 {{{#!td align=left valign=top
    378 `∈` ([http://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609)
    379 }}}
    380 {{{#!td align=left  valign=top   
     376{{{#!td align=center valign=top
     377`∈` ([https://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609)
     378}}}
     379{{{#!td align=left valign=top
    381380element of
    382381
    383 }}}
    384 {{{#!td align=left  valign=top   
    385 {{{
    386 #!mapcss
    387 node[amenity=parking] ∈ *[amenity=parking] {
     382Matches when an object matches the right selector(s) contains at least one element which match the left selector(s).
     383}}}
     384{{{#!td align=left valign=top
     385{{{
     386#!mapcss
     387*[amenity=parking] ∈ area[amenity=parking] {
    388388  throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking");
    389389}
    390390}}}
    391 }}}
    392 |-------------------------------------------------------------------------------
    393 {{{#!td align=left  valign=top
    394 `⧉` ([http://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613)
    395 }}}
    396 {{{#!td align=left  valign=top   
     391Finds 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
     395`⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102)
     396}}}
     397{{{#!td align=left valign=top
     398Subset of or Equal To
     399
     400Synonym for `∈`.
     401}}}
     402{{{#!td align=left valign=top
     403{{{
     404#!mapcss
     405*[amenity=parking] ⊆ area[amenity=parking] {
     406  throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking");
     407}
     408}}}
     409
     410}}}
     411|-------------------------------------------------------------------------------
     412{{{#!td align=center valign=top
     413`⊇` ([https://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102)
     414}}}
     415{{{#!td align=left valign=top
     416Superset of or Equal To
     417
     418Matches when an object matches the right selector(s) and is contained in one or more elements which match the left selectors.
     419}}}
     420{{{#!td align=left valign=top
     421{{{
     422#!mapcss
     423area[amenity=parking] ⊇ *[amenity=parking]
     424}}}
     425finds 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.
     426}}}
     427|-------------------------------------------------------------------------------
     428{{{#!td align=center valign=top
     429`⊈` ([https://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102)
     430}}}
     431{{{#!td align=left valign=top
     432Neither a Subset of nor Equal To
     433
     434Matches when an object matches the right selector(s) and does not contain any element which matches the left selectors.
     435}}}
     436{{{#!td align=left valign=top
     437{{{
     438#!mapcss
     439*[highway=street_lamp] ⊈ area:closed2[amenity=parking][lit=yes]
     440}}}
     441finds 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
     445`⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102)
     446}}}
     447{{{#!td align=left valign=top
     448Neither a Superset of nor Equal To
     449
     450Matches when an object matches the right selector(s) and is not contained in any area which matches the left selectors.
     451}}}
     452{{{#!td align=left valign=top
     453{{{
     454#!mapcss
     455area[landuse=residential] ⊉ *[building]
     456}}}
     457finds 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
     461`⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613)
     462}}}
     463{{{#!td align=left valign=top
    397464crossing
    398 
    399 }}}
    400 {{{#!td align=left  valign=top   
     465}}}
     466{{{#!td align=left valign=top
    401467{{{
    402468#!mapcss
     
    405471}
    406472}}}
    407 }}}
    408 
    409 Since r6554, it is possible to prefix the "value" (i.e., expression after the operator) with a `*` in order to "de-reference" it (i.e., obtain consider it as another key and obtain its value). Thus, `[key1 = *key2]` compares the value of `key1` with the value of `key2`, and `[key =~ */pattern/]` considers the value of the key `pattern` as a regular expression and matches it against the value of `key`.
     473takes `layer` tag into account if set (since r12986)
     474}}}
     475
     476Since r6554, it is possible to prefix the "value" (i.e., expression after the operator) with a `*` in order to "de-reference" it (i.e., obtain consider it as another key and obtain its value). Thus, `[key1 = *key2]` or `[key1=*key2]` compares the value of `key1` with the value of `key2`, and `[key =~ */pattern/]` considers the value of the key `pattern` as a regular expression and matches it against the value of `key`.
    410477
    411478In addition, you can test whether a tag is present or not:
    412479
    413 {{{#!th align=left valign=top
     480{{{#!th valign=top
    414481'''Condition'''
    415482}}}
    416 {{{#!th align=left valign=top
     483{{{#!th valign=top
    417484'''Example'''
    418485}}}
     
    424491{{{
    425492#!mapcss
    426 way[highway]                     /* matches any way with a tag 'highway'                                              */
    427 way["VALSOU"]                    /* use quotes if case sensitive matching is required                                 */
    428 way["name:fr"]                   /* use quotes if the tag name includes special caracters (white space, colons, etc.) */
     493way[highway]                     /* matches any way with a tag 'highway' (is case sensitive)                                              */
     494way["name:fr"]                   /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */
    429495}}}
    430496}}}
     
    436502{{{
    437503#!mapcss
    438 way[!highway]                     /* matches any way which does not have a tag 'highway'                                              */
    439 way[!"VALSOU"]                    /* use quotes if case sensitive matching is required                                 */
    440 way[!"name:fr"]                   /* use quotes if the tag name includes special caracters (white space, colons, etc.) */
     504way[!highway]                     /* matches any way which does not have a tag 'highway' (is case sensitive)                               */
     505way[!"name:fr"]                   /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */
    441506}}}
    442507}}}
    443508|-------------------------------------------------------------------------------
    444509{{{#!td align=left  valign=top
    445 Presence of tag by [http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum Regular expression] match (since r6547)
     510Presence 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)
    446511}}}
    447512{{{#!td align=left  valign=top   
     
    462527}}}
    463528
    464 You can test whether the the value of a tag is logical truth value. The value is evaluated to true, if it is either
     529You can test whether the value of a tag is logical truth value. The value is evaluated to true, if it is either
    465530"yes", "true", or "1". All other values are evaluated to false.
    466531
    467 {{{#!th align=left valign=top
     532{{{#!th valign=top
    468533'''Condition'''
    469534}}}
    470 {{{#!th align=left valign=top
     535{{{#!th valign=top
    471536'''Example'''
    472537}}}
     
    478543{{{
    479544#!mapcss
    480 way[oneway?]                  /* matches any way with a truth value in the tag 'oneway'  */
     545way[oneway?]                   /* matches any way with a truth value in the tag 'oneway' */
    481546}}}
    482547}}}
     
    488553{{{
    489554#!mapcss
    490 way[oneway?!]                  /* matches any way with a false value in the tag 'oneway'  */
    491 }}}
    492 }}}
    493 
    494 === Link selector ===
     555way[oneway?!]                  /* matches any way with a false value in the tag 'oneway' */
     556}}}
     557}}}
     558
     559=== Territory selector === #Territoryselector
     560You can test whether an object is located inside or outside of a specific territory. JOSM has an internal database for this. The [source:/trunk/resources/data/boundaries.osm territories file] can be downloaded and opened in JOSM to investigate it [attachment:boundaries.png (screenshot preview)]. It contains borders of all countries of the world. Due to performance reasons the borders are simplified. They can be refined for special cases on request. The territories are "tagged" with their [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO_3166-1_alpha-2 codes]. USA, Canada, China, India and Australia have additional boundaries for their subdivisions. See the following examples on how to use the territory selectors. Territory selectors are less useful in mappaint styles and can be very resource heavy there. However they are much more useful for [wikitr:/Help/Validator/MapCSSTagChecker mapcss based validator rules]. To select territories with left-hand-traffic or right-hand-traffic, there is a simpler way, see [#PseudoClasses Pseudo Classes]. See #10387 for main implementation of this feature.
     561
     562{{{
     563#!mapcss
     564                                      /* matches any node located …                             */
     565node[inside("FR")]                    /* … inside of France (includes the overseas territories) */
     566node[inside("FX")]                    /* … inside of Metropolitan France (i.e. only the
     567                                         mainland part with its near islands including Corse)   */
     568node[inside("EU")]                    /* … inside of the European Union                         */
     569node[inside("FR,DE")]                 /* … inside of France __OR__ inside of Germany            */
     570node[inside("US-FL")]                 /* … inside of the US state Florida                       */
     571
     572node[outside("FR")]                   /* … outside of France                                    */
     573node[outside("FR,DE")]                /* … outside of France __AND__ outside of Germany         */
     574node[inside("US")][outside("US-FL")]  /* … inside of the USA except the state Florida           */
     575}}}
     576
     577=== Link selector ===#LinkSelector
    495578In a child selector, you can formulate conditions on the link between a parent and a child object.
    496579
     
    503586}}}
    504587
    505 {{{#!th align=left valign=top
     588{{{#!th valign=top
    506589'''Operator'''
    507590}}}
    508 {{{#!th align=left valign=top
     591{{{#!th valign=top
    509592'''Description'''
    510593}}}
    511 {{{#!th align=left valign=top
     594{{{#!th valign=top
    512595'''Example'''
    513596}}}
    514597|-------------------------------------------------------------------------------
    515 {{{#!td align=left  valign=top
     598{{{#!td align=center  valign=top
    516599`=`
    517600}}}
    518601{{{#!td align=left  valign=top   
    519 Exact match of the role name. The name name {{{role}}} is compulsory in this context.
     602Exact match of the role name. The name `role` is compulsory in this context.
    520603}}}
    521604{{{#!td align=left  valign=top   
    522605{{{
    523606#!mapcss
    524 relation >[role=residential] way           /* without quotes always case insensitive */
    525 relation >[role="My name"]   way           /* use quotes for if the role value includes spaces or if case sensitive matching is important */
    526 }}}
    527 }}}
    528 
    529 The operators {{{!=, ^=, $=, *=, and ~=}}} are supported too. Please refer to [#condition_selector_operators condition selector operators].
    530 
    531 Nodes in ways and members in relations are ordered. You can formulate conditions on the position of a node in a way or a member
    532 object in a relation. Positive numbers count from first to last element, negative numbers (since r8206) count from last to first element.
     607relation >[role=residential] way           
     608relation >[role="My name"]   way           /* use quotes if the role value includes spaces or other special characters */
     609}}}
     610}}}
     611
     612The operators `!=`, `^=`, `$=`, `*=` and `~=` are supported too. Please refer to [#condition_selector_operators condition selector operators].
     613
     614Nodes in ways and members in relations are ordered. You can formulate conditions on the position of a node in a way or a member object in a relation. Positive numbers count from first to last element, negative numbers (since r8236) count from last to first element.
    533615
    534616{{{
     
    548630}}}
    549631
    550 
    551632=== Zoom selector ===
    552 You can decorate a type selector with a '''zoom selector'''. The zoom selector restricts the range of zoom levels
    553 at which the respective MapCSS rule is applied.
    554 
    555 {{{#!th align=left valign=top
    556 '''Example'''
    557 }}}
    558 {{{#!th align=left valign=top
    559 '''Description'''
    560 }}}
    561 |-------------------------------------------------------------------------------
    562 || {{{way|z12 {...} }}} || At zoom level 12 ||
    563 || {{{way|z13-15 {...} }}} || From 13 to 15 ||
    564 || {{{way|z16- {...} }}} || 16 and above ||
    565 || {{{way|z-12 {...} }}} || 12 and below ||
    566 || {{{way {...} }}} || any zoom level ||
     633You 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.
     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 ||
    567640
    568641The 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''.
    569642
    570 
    571 === Pseudo Classes ===
    572 See [https://josm.openstreetmap.de/doc/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.PseudoClasses.html Javadoc] for the up-to-date list of pseudo classes supported by JOSM's MapCSS implementation.
    573 
    574 || {{{:closed}}} || true for ways where the first node is the same as the last and for any multipolygon relation ||
    575 || {{{:new}}} || all new objects ||
    576 || {{{:connection}}} || true for nodes that are used by more than one way ||
    577 || {{{:unconnected}}} || true for nodes that are not used by any way (since r6687) ||
    578 || {{{: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)
    579 || {{{:righthandtraffic}}} || true if there is right-hand traffic at the current location (since r7193); see [[left-right-hand-traffic]] for screenshot of areas ||
    580 || {{{:unclosed_multipolygon}}} || true for fully loaded unclosed multipolygon relations (since r8252) ||
    581 || {{{:open_end}}} || to select end nodes of unclosed multipolygon relations with `relation:unclosed_multipolygon >:open_end node` (since r8252) ||
    582 || {{{:in-downloaded-area}}} || true if an object is within source area and false if in the hatched area (since 8495). ||
    583 {{{#!comment
    584 || {{{:modified}}} || changed objects (Note that the styles are not updated when you move a node, so you have to switch the style sheet on and off to get an updated view.) (since r7193) ||
    585 }}}
    586 You can also negate pseudo classes. E.g. {{{!:new}}} for all old objects.
     643=== Pseudo Classes ===#PseudoClasses
     644See [/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.
     645
     646||= '''Class''' =||= '''Description''' =||
     647|| `:closed` || true for ways where the first node is the same as the last and for any (completely downloaded) multipolygon relation ||
     648|| `:closed2` || same as above, but this one ignores if a multipolygon is downloaded completely (since r9099) ||
     649|| `:completely_downloaded` || true for a relation whose members are all downloaded (since r9099) ||
     650|| `:new` || all new objects ||
     651|| `:connection` || true for nodes that are used by more than one way ||
     652|| `:unconnected` || true for nodes that are not used by any way (since r6687) ||
     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 ||
     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 ||
     656|| `:clockwise` || Whether the way is closed and oriented clockwise, or non-closed and the 1st, 2nd and last node are in clockwise order. ||
     657|| `:anticlockwise` || Whether the way is closed and oriented anticlockwise, or non-closed and the 1st, 2nd and last node are in anticlockwise order. ||
     658|| `:unclosed_multipolygon` || true for fully loaded unclosed multipolygon relations (since r8252) ||
     659|| `:open_end` || to select end nodes of unclosed multipolygon relations with `relation:unclosed_multipolygon >:open_end node` (since r8252) ||
     660|| `:in-downloaded-area` || true if an object is within source area and false if in the hatched area (since r8495). ||
     661|| `:selected` || true if an object is selected in the editor (since r9341). ||
     662|| `:highlighted` || true if the object is highlighted ||
     663|| `:modified` || changed and new objects (since r7193). ||
     664You can also negate pseudo classes. E.g. `!:new` for all old objects.
    587665
    588666=== Layer Identifier ===
    589 
    590667Layers can be used to create more than one style for a single object. Here is an example:
    591668{{{
     
    601678}
    602679
    603 way[access][access!=public]::non_public_access_layer {
     680way[access][access!=yes]::non_public_access_layer {
    604681    width: +2;
    605682    color:red;
     
    615692}
    616693}}}
    617 This draws all secondary and tertiary roads in yellow and orange respectively. Any road with an access tag other than public will get an extra line style below ('''{{{object-z-index:-1.0;}}}''') the main line. If that part of the street happens to be a bridge, it will also get a half transparent blue overlay. The relative width value ('''{{{width: +2;}}}''') refers to the width on the default layer (2 or 3 in this case).
     694This draws all secondary and tertiary roads in yellow and orange respectively. Any road with an access tag other than yes will get an extra line style below ('''`object-z-index:-1.0;`''') the main line. If that part of the street happens to be a bridge, it will also get a half transparent blue overlay. The relative width value ('''`width: +2;`''') refers to the width on the default layer (2 or 3 in this case).
    618695
    619696The name for the layer can be any identifier.
    620697
    621  default::
    622  If you omit the layer in the selector, this is the same as using {{{::default}}}.
    623  *::
    624  In addition, you can use the * layer to override and initialize all layers.[[br]]
    625  It overrides all existing subparts, so
     698If you omit the layer in the selector, this is the same as using `::default`.
     699
     700One more example:
     701{{{
     702#!mapcss
     703node[amenity=parking] {
     704    icon-image: "presets/vehicle/parking/parking.svg";    /* displays the josm internal parking icon in the default layer */
     705    text: ref;                                            /* displays the value of the key ref as text in the default layer */
     706}
     707
     708node[amenity=parking][fee=yes]::fee {
     709    icon-image: "presets/money/exchange.svg";             /* displays the josm internal exchange icon in the fee layer */
     710    icon-offset-x: 14;                                    /* shift the icon */
     711    icon-offset-y: -12;                                   /* shift the icon */
     712    text: charge;                                         /* displays the value of the key charge as text in the fee layer */
     713    text-offset-x: 16;                                    /* shift the text */
     714    text-offset-y: 17;                                    /* shift the text */
     715}
     716}}}
     717The result looks this way:
     718
     719[[Image(multiple_icons_and_texts.png,link=)]]
     720
     721In addition, you can use the * layer to override and initialize all layers. \\
     722It overrides all existing subparts, so
     723
    626724{{{
    627725#!mapcss
    628726way::A { a; }
    629727way::B { b; }
    630 way::* { c; }
    631 }}}
    632  is equivalent to
     728way::* { c; }  /* overrides all existing subparts */
     729}}}
     730is equivalent to
    633731{{{
    634732#!mapcss
    635733way::A { a; }
    636734way::B { b; }
    637 way::A { c; }
    638 way::B { c; }
    639 }}}
    640  And it initializes new subparts. In other words:
     735way::A { c; } /* overrides a with c all existing subparts */
     736way::B { c; } /* overrides b with c all existing subparts */
     737}}}
     738And it initializes new subparts. In other words:
    641739{{{
    642740#!mapcss
     
    644742way::A { b; }
    645743}}}
    646  is equivalent to
     744is equivalent to
    647745{{{
    648746#!mapcss
     
    651749way::A { b; }
    652750}}}
    653  which is in turn the same as
     751which is in turn the same as
    654752{{{
    655753#!mapcss
     
    657755way::A { b; }
    658756}}}
    659  or
     757or
    660758{{{
    661759#!mapcss
     
    663761}}}
    664762
    665 
    666763=== Grouping ===
    667 
    668764Rules with common declaration block can be grouped into one:
    669765{{{
     
    704800way.path { text:auto; text-color: green; text-position: line; text-offset: 5; }
    705801}}}
    706 You can also negate classes. E.g. {{{way!.path}}} for all ways, which are not part of the class ''.path''.
    707 
    708 == @supports rule for conditional processing [''since 8087''] ==
    709 
    710 @supports rules are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. Example:
     802You 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 ===
     805If you want to use layer and classes together, please note that you have to identify the class via is_prop_set.
     806
     807{{{#!mapcss
     808node[railway=signal] { set sgnl; }
     809
     810/* it doesn't work */
     811node.sgnl::layer_signal_icon  { z-index: 1000; ... icon: icon/signal-icon.svg; ... }
     812node.sgnl::layer_signal_text  { z-index: 1010; ... text: concat("Name of signal: ", tag("ref")); ..... )
     813
     814/* use instead: is_prop_set("...", "default") */
     815node[is_prop_set("sgnl", "default")]::layer_signal_icon  { z-index: 1000; ... icon: icon/signal-icon.svg; ... }
     816node[is_prop_set("sgnl", "default")]::layer_signal_text  { z-index: 1010; ... text: concat("Name of signal: ", tag("ref")); ..... )
     817}}}
     818
     819=== @supports Conditional Processing  ===
     820@supports rules are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. This feature came with r8087. Example:
    711821{{{
    712822#!mapcss
     
    737847}}}
    738848
    739 The syntax closely matches the official [http://dev.w3.org/csswg/css-conditional/ css syntax]. The following conditions are supported:
     849The syntax closely matches the official [https://drafts.csswg.org/css-conditional/ css syntax]. The following conditions are supported:
    740850
    741851{{{#!th
     
    757867}}}
    758868{{{#!td
    759 Only include {{{@supports}}} section when the current version of JOSM is greater than or equal to the specified number.
     869Only include `@supports` section when the current version of JOSM is greater than or equal to the specified number.
    760870}}}
    761871|-
     
    764874}}}
    765875{{{#!td
    766 Only include {{{@supports}}} section when the current version of JOSM is lower than or equal to the specified number.
     876Only include `@supports` section when the current version of JOSM is lower than or equal to the specified number.
    767877}}}
    768878|-
     
    771881}}}
    772882{{{#!td
    773 Only include {{{@supports}}} section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is {{{josm}}}.
    774 }}}
    775 
    776 Conditions can be combined with {{{and}}}:
     883Only include `@supports` section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is `josm`.
     884}}}
     885
     886Conditions can be combined with `and`:
    777887
    778888{{{
     
    783893}}}
    784894
    785 Other logical operators like {{{or}}} and {{{not}}} can also be used. Parentheses are needed if you want to combine different logical operators:
     895Other logical operators like `or` and `not` can also be used. Parentheses are needed if you want to combine different logical operators:
    786896
    787897{{{
     
    792902}}}
    793903
    794 Since @supports rules are only supported in JOSM 8087 and later, you should also specify this as minimum JOSM version in the meta selector:
     904Since @supports rules are only supported in JOSM r8087 and later, you should also specify this as minimum JOSM version in the meta selector:
    795905
    796906{{{
     
    802912}}}
    803913
    804 == Media queries [''since 6970'']  (deprecated) ==
    805 
    806 {{{#!td style="background-color: #faa"
    807 Note: media queries are deprecated. You should use @supports rules instead (see above).
    808 }}}
    809 Media queries are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. Example:
    810 {{{
    811 #!mapcss
    812 @media (min-josm-version: 9789) {
    813     way[highway] {
    814         width: 4;
    815         color: orange;
    816     }
    817     /* fancy new stuff */
    818     /* ... */
    819 }
    820 
    821 @media (max-josm-version: 9788) {
    822     way[highway] {
    823         width: 4;
    824         color: blue;
    825     }
    826     /* fall back mode, using more simple features */
    827     /* ... */
    828 }
    829 }}}
    830 
    831 The syntax closely matches the official [http://www.w3.org/TR/css3-mediaqueries/#syntax css syntax]. The following conditions are supported:
    832 
    833 {{{#!th
    834 '''Media condition'''
    835 }}}
    836 {{{#!th
    837 '''Description'''
    838 }}}
    839 |-
    840 {{{#!td
    841 (min-josm-version: ''<number>'')
    842 }}}
    843 {{{#!td
    844 Only include {{{@media}}} section when the current version of JOSM is greater than or equal to the specified number.
    845 }}}
    846 |-
    847 {{{#!td
    848 (max-josm-version: ''<number>'')
    849 }}}
    850 {{{#!td
    851 Only include {{{@media}}} section when the current version of JOSM is lower than or equal to the specified number.
    852 }}}
    853 |-
    854 {{{#!td
    855 (user-agent: ''<string>'')
    856 }}}
    857 {{{#!td
    858 Only include {{{@media}}} section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is {{{josm}}}.
    859 }}}
    860 
    861 Conditions can be combined with {{{and}}}:
    862 
    863 {{{
    864 #!mapcss
    865 @media (min-josm-version: 6970) and (max-josm-version: 7014) {
    866  /* only for JOSM versions 6970 to 7014 */
    867 }
    868 }}}
    869 
    870 Multiple combined conditions can be chained with a comma (logical ''or''):
    871 
    872 {{{
    873 #!mapcss
    874 @media (min-josm-version: 6970) and (max-josm-version: 7014), (user-agent: myEditor) {
    875   /* for JOSM version 6970 to 7014 and for the editor called "myEditor" */
    876 }
    877 }}}
    878 
    879 Since media queries are only supported in JOSM 6970 and later, you should also specify this as minimum JOSM version in the meta selector:
    880 
    881 {{{
    882 #!mapcss
    883 meta {
    884     min-josm-version: "6970"; /* This style uses media queries */
    885     /* ... */
    886 }
    887 }}}
    888 
    889 
    890 {{{#!comment
    891 There is also the {{{not}}} keyword (see the linked css doc for details).
    892 This is implemented, but probably not very useful. Feel free to add documentation.
    893 }}}
    894914
    895915== Style settings ==
    896 
    897 [[Help/Dialog/MapPaint/StyleSettings|Styles settings]] are used to provide the user settings to customize a mappaint style. The user can use them in the MapPaint dialog. Style settings are availible since r7450. The internal style provides style settings since r7454. Note that there are plans to extend the implementation of style settings (currently there are only boolean values supported), so the mapcss syntax for style settings could change in the future (see #10435).
    898 
    899 create a setting:
     916[wikitr:/Help/Dialog/MapPaint/StyleSettings Styles settings] are used to provide the user settings to customize a mappaint style. The user can use them in the [wikitr:/Help/Dialog/MapPaint MapPaint dialog]. The following `type` of settings are available:
     917* `boolean` (since r7450)
     918* `double` (since r15731, see #10435)
     919* `string` (since r15731, see #10435)
     920* `color` (since r16843, see #10435)
     921
     922=== Settings of type `boolean` ===
     923Create a setting of type `boolean`:
    900924{{{
    901925#!mapcss
     
    906930}
    907931}}}
    908 use a setting:
     932
     933Use a setting of type `boolean`:
    909934{{{
    910935#!mapcss
     
    915940}}}
    916941
    917 == Properties ==
    918 
     942=== Settings of type `double` ===
     943Create a setting of type `double`:
     944{{{
     945#!mapcss
     946setting::place_font_size {
     947  type: double;
     948  label: tr("Set place name font size...");
     949  default: 11;
     950}
     951}}}
     952
     953Use a setting of type `double`:
     954{{{
     955#!mapcss
     956node.place, way.place, area.place {
     957  font-size: setting("place_font_size");
     958}
     959}}}
     960
     961=== Settings of type `string` ===
     962Create a setting of type `string`:
     963{{{
     964#!mapcss
     965setting::textdisplay {
     966  type: string;
     967  label: tr("key used for displaying");
     968  default: "name"; /* examples for usage: alt_name, old_name, addr:housename, ref, operator, ... */
     969}
     970}}}
     971
     972Use a setting of type `string`:
     973{{{
     974#!mapcss
     975way {
     976  text: tag(setting("textdisplay"));
     977}
     978}}}
     979
     980=== Settings of type `color` ===
     981Create a setting of type `color`. The `default` color can be any color as understood under [wikitr:/Help/Styles/MapCSSImplementation#Propertyvaluesexplanations Property values explanations]:
     982{{{
     983#!mapcss
     984setting::colordisplay {
     985  type: color;
     986  label: tr("key used for displaying");
     987  default: colorDisplayCustomPref#FF00FF;
     988}
     989}}}
     990
     991Use a setting of type `color`:
     992{{{
     993#!mapcss
     994way {
     995  color: setting("colordisplay");
     996}
     997}}}
     998
     999=== Grouping settings ===
     1000Similar settings can be grouped together by defining ''settings groups'' (since r15289):
     1001
     1002{{{
     1003#!mapcss
     1004settings::my_group {
     1005  label: tr("my wonderful group");
     1006  icon: "my_beautiful_icon";
     1007}
     1008}}}
     1009
     1010Label is mandatory, icon is optional.
     1011
     1012Once a setting group is defined, it can be referenced from all settings belonging to it:
     1013
     1014{{{
     1015#!mapcss
     1016setting::hide_icons {
     1017  type: boolean;
     1018  label: tr("Hide icons at low zoom");
     1019  default: true;
     1020  group: "my_group";
     1021}
     1022}}}
     1023
     1024Settings 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
     1026
     1027== Properties ==#Properties
    9191028=== General properties ===
    9201029
    9211030||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    922 || {{{z-index}}}                                 || Specify the order the objects are drawn: The objects with higher z-index are drawn on top of objects with lower z-index || ''Number'' (can be negative) ||  0  ||
    923 || {{{major-z-index}}} || Similar to {{{z-index}}}, but it has higher priority than {{{z-index}}}. So if one object has a higher {{{major-z-index}}} than the other, it is drawn on top. If the {{{major-z-index}}} is the same, {{{z-index}}} decides. || ''Number'' (can be negative) ||  Depends on style element: area: 1, casing: 2, left-/right-casing: 2.1, line-pattern: 2.9, line: 3, point: 4, default-point: 4.1, line-text: 4.9, point-text: 5  ||
    924 || {{{object-z-index}}} || Similar to {{{z-index}}}, but has lower priority. Controls the painting order for overlapping objects. E.g. for two crossing ways with text: Use {{{z-index}}} or {{{major-z-index}}} if you first want to draw the two lines and then the two captions. Use {{{object-z-index}}} if one of the ways should be completely on top of the other. || ''Number'' (can be negative) ||  0  ||
    925 || {{{modifier}}} || Better control, whether a default line / node symbol is generated by JOSM. This happens when there is no proper style ({{{modifier=false}}}) found on any layer. || {{{false}}} or {{{true}}} || {{{false}}} for the default layer and {{{true}}} for any other layer ||
    926 
    927 
     1031|| `z-index` || Specify the order the objects are drawn: The objects with higher z-index are drawn on top of objects with lower z-index || ''Number'' (can be negative) ||  0  ||
     1032|| `major-z-index` || Similar to `z-index`, but it has higher priority than `z-index`. So if one object has a higher `major-z-index` than the other, it is drawn on top. If the `major-z-index` is the same, `z-index` decides. || ''Number'' (can be negative) || Depends on style element: area: 1, casing: 2, left-/right-casing: 2.1, line-pattern: 2.9, line: 3, point: 4, default-point: 4.1, line-text: 4.9, point-text: 5 ||
     1033|| `object-z-index` || Similar to `z-index`, but has lower priority. Controls the painting order for overlapping objects. E.g. for two crossing ways with text: Use `z-index` or `major-z-index` if you first want to draw the two lines and then the two captions. Use `object-z-index` if one of the ways should be completely on top of the other. || ''Number'' (can be negative) ||  0  ||
     1034|| `modifier` || Better control, whether a default line / node symbol is generated by JOSM. This happens when there is no proper style (`modifier=false`) found on any layer. || `false` or `true` || `false` for the default layer and `true` for any other layer ||
     1035
     1036Note that due to performance reasons the values for the three z-indexes are limited to 24 bit float values with max. 5 decimal digits. Currently the internal mappaint style uses values with max. 2 digits before and after the decimal separator. To avoid problems use values of z-indexes between -99.999 and +99.999. (See also #14485)
    9281037
    9291038=== Icon and symbol styles ===
    9301039
    9311040||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    932 || {{{icon-image}}} || The icon at node position || ''Image'' ||  -  ||
    933 || {{{icon-opacity}}} || Opacity of the icon image || ''Opacity'' ||  1.0  ||
    934 || {{{icon-width}}} || Width of the icon. If only one of the properties {{{icon-width}}} and {{{icon-height}}} is given, the image will be scaled proportionally. The icon will keep the original size, if neither {{{icon-width}}} nor {{{icon-height}}} is set. || ''Number'' ||  -  ||
    935 || {{{icon-height}}} || Height of the icon. (See {{{icon-width}}}) || ''Number'' ||  -  ||
     1041|| `icon-image` || The icon at node position. See also [wikitr:/Help/Styles/Images Images]. || ''Image'' ||  -  ||
     1042|| `icon-opacity` || Opacity of the icon image || ''Opacity'' ||  1.0  ||
     1043|| `icon-width` || Width of the icon. If only one of the properties `icon-width` and `icon-height` is given, the image will be scaled proportionally. The icon will keep the original size, if neither `icon-width` nor `icon-height` is set. || ''Number'' ||  -  ||
     1044|| `icon-height` || Height of the icon. (See `icon-width`) || ''Number'' ||  -  ||
    9361045|| `icon-offset-x` || Shift the icon in horizontal direction (positive values to the right) (since r8085) || ''Number'' ||  0  ||
    9371046|| `icon-offset-y` || Shift the icon in vertical direction (positive values downwards) (since r8085) || ''Number'' ||  0  ||
    938 || `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`. ||  -  ||
    939 || {{{symbol-shape}}}                               || Display a symbol at the position of the node || {{{square}}}, {{{circle}}}, {{{triangle}}}, {{{pentagon}}}, {{{hexagon}}}, {{{heptagon}}}, {{{octagon}}}, {{{nonagon}}}, {{{decagon}}} ||  -  ||
    940 || {{{symbol-size}}} || Size of the symbol || ''Number'', can be relative ("+4") ||  10  ||
    941 || {{{symbol-stroke-width}}} || outline stroke width || ''Width'' ||  1.0 if {{{symbol-stroke-color}}} is set  ||
    942 || {{{symbol-stroke-color}}} || line color || ''Color'' || {{{#FFC800}}} if {{{symbol-stroke-width}}} is set ||
    943 || {{{symbol-stroke-opacity}}} || line opacity || ''Opacity'' ||  1.0  ||
    944 || {{{symbol-fill-color}}} || fill color for the shape || ''Color'' || {{{blue}}}, unless either {{{symbol-stroke-width}}} or {{{symbol-stroke-color}}} is set ||
    945 || {{{symbol-fill-opacity}}} || fill opacity || ''Opacity'' ||  1.0  ||
    946 || {{{text-...}}}, {{{font-...}}} ||||||  general text & font properties  ||
    947 || {{{text-anchor-horizontal}}} || horizontal text label placement || {{{left}}}, {{{center}}}, {{{right}}} ||  {{{right}}}  ||
    948 || {{{text-anchor-vertical}}} || vertical text label placement || {{{above}}}, {{{top}}}, {{{center}}}, {{{bottom}}}, {{{below}}} ||  {{{bottom}}}  ||
    949 
    950 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.
    951 
    952 
    953 
    954 
    955 
    956 === Line styles ===
     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|| `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || `center`, `inside`, `line` ||  `center`  ||
     1049|| `symbol-shape` || Display a symbol at the position of the node || `square`, `circle`, `triangle`, `pentagon`, `hexagon`, `heptagon`, `octagon`, `nonagon`, `decagon` ||  -  ||
     1050|| `symbol-size` || Size of the symbol || ''Number'', can be relative ("+4") ||  10  ||
     1051|| `symbol-stroke-width` || outline stroke width || ''Width'' || 1.0 if `symbol-stroke-color` is set ||
     1052|| `symbol-stroke-color` || line color || ''Color'' || `#FFC800` if `symbol-stroke-width` is set ||
     1053|| `symbol-stroke-opacity` || line opacity || ''Opacity'' ||  1.0  ||
     1054|| `symbol-fill-color` || fill color for the shape || ''Color'' || `blue`, unless either `symbol-stroke-width` or `symbol-stroke-color` is set ||
     1055|| `symbol-fill-opacity` || fill opacity || ''Opacity'' ||  1.0  ||
     1056|| `text-...`, `font-...` ||||||  see general '''Text & Font properties''' ||
     1057
     1058Do 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.
     1059
     1060=== Line styles ===#LineStyles
    9571061||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    958 || {{{width}}} || Line width || ''Width'' ||  -  ||
    959 || {{{color}}} || Line color || ''Color'' ||  value of {{{fill-color}}} or (if unset) JOSM's default untagged color ({{{#808080}}}) ||
    960 || {{{opacity}}} || How transparent the line is. || ''Opacity'' ||  1.0  ||
    961 || {{{dashes}}} || An array of alternating on/off lengths || list of numbers, e.g. [[br]]> 15, 5 [[br]][[br]]may be written as expression: [[br]] > {{{list(3, 4, 5, 6)}}} [[br]][[br]]or the keyword {{{none}}}[[br]]to turn dashes off ||  -  ||
    962 || {{{dashes-offset}}} || shift the dash pattern by a certain amount || ''Number'' (>= 0) ||  0  ||
    963 || {{{dashes-background-color}}} || The color to use in between the dashes (optional) || ''Color'' ||  -  ||
    964 || {{{dashes-background-opacity}}} || Opacity value for the dashes background || ''Opacity'' ||  value of {{{opacity}}}  ||
    965 || {{{linecap}}} || Shape at the end of the line (see [http://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty here]) || {{{none}}}, {{{round}}}, {{{square}}} ||  {{{none}}}  ||
    966 || {{{linejoin}}} || Shape at the line corners || {{{round}}}, {{{miter}}}, {{{bevel}}} ||  {{{round}}}  ||
    967 || {{{miterlimit}}}                                   || Applies for {{{linejoin: miter}}}. Sets the maximum overshoot when line segments meet at a very small angle || ''Number'' (>= 1.0) ||  10.0  ||
    968 || {{{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  ||
    969 || {{{text-position}}} || set to {{{line}}}, if text should be drawn along the line || {{{line}}}, {{{center}}} ||  -  ||
    970 || {{{text-...}}}, {{{font-...}}} ||||||  general text & font properties  ||
    971 || `repeat-image` || repeated image along a line ''[since 5801]'' || ''Image'' ||  -  ||
    972 || `repeat-image-width` || Width of the image (optional, see `icon-width`) ''[since 5811]'' || ''Number'' ||  -  ||
    973 || `repeat-image-height` || Height of the image (optional) ''[since 5811]'' || ''Number'' ||  -  ||
    974 || `repeat-image-align` || Alignment of the image. Top-, bottom edge or the (horizontal) center line of the image will be along the line ''[since 5801]'' || `top`, `center`, `bottom` ||  `center`  ||
    975 || `repeat-image-offset` || Offset from the line ''[since 5801]'' || ''Number'' ||  0  ||
    976 || `repeat-image-spacing` || Spacing between repeated images ''[since 5801]'' || ''Number'' ||  0  ||
    977 || `repeat-image-phase` || Initial spacing at the beginning of the line ''[since 5812]'' || ''Number'' ||  0  ||
    978 
    979 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.
     1062|| `width` || Line width || ''Width'' ||  -  ||
     1063|| `color` || Line color || ''Color'' ||  value of `fill-color` or\\(if unset) JOSM's default \\untagged color (`#808080`) ||
     1064|| `opacity` || How transparent the line is. || ''Opacity'' ||  1.0  ||
     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 ||  -  ||
     1066|| `dashes-offset` || shift the dash pattern by a certain amount || ''Number'' (>= 0) ||  0  ||
     1067|| `dashes-background-color` || The color to use in between the dashes (optional) || ''Color'' ||  -  ||
     1068|| `dashes-background-opacity` || Opacity value for the dashes background || ''Opacity'' ||  value of `opacity`  ||
     1069|| `linecap` || Shape at the end of the line (see [https://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty here]) || `none`, `round`, `square` ||  `none`  ||
     1070|| `linejoin` || Shape at the line corners || `round`, `miter`, `bevel` ||  `round`  ||
     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  ||
     1073|| `text-position` || set to `line`, if text should be drawn along the line || `line`, `center` ||  -  ||
     1074|| `text-...`,\\`font-...` |||||| see general '''Text & Font properties  ||
     1075|| `repeat-image` || repeated image along a line ''(since r5801)'' || ''Image'' ||  -  ||
     1076|| `repeat-image-width` || Width of the image (optional, see `icon-width`) ''(since r5811)'' || ''Number'' ||  -  ||
     1077|| `repeat-image-height` || Height of the image (optional) ''(since r5811)'' || ''Number'' ||  -  ||
     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`  ||
     1079|| `repeat-image-offset` || Offset from the line ''(since r5801)'' || ''Number'' ||  0  ||
     1080|| `repeat-image-spacing` || Spacing between repeated images ''(since r5801)'' || ''Number'' ||  0  ||
     1081|| `repeat-image-phase` || Initial spacing at the beginning of the line ''(since r5812)'' || ''Number'' ||  0  ||
     1082|| `repeat-image-opacity` || Opacity of the repeated image ''(since r16700)'' || ''Number'' ||  1.0  ||
     1083
     1084All 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.
    9801085||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    981 || {{{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) ||  -  ||
    982 || {{{casing-color}}} || Casing color || ''Color'' ||  value of {{{fill-color}}} or (if unset) JOSM's default untagged color ({{{#808080}}}) ||
    983 || {{{casing-opacity}}} || How transparent the casing is. || ''Opacity'' ||  1.0  ||
    984 || {{{casing-}}}... || ... || ... ||  ...  ||
    985 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.
    986 
    987 === Area styles ===
    988 ||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    989 || {{{fill-color}}} || Color in which to fill the area || ''Color'' ||  -  ||
    990 || {{{fill-image}}} || Image pattern || ''Image'' ||  -  ||
    991 || {{{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 9008]'' || ''Number'' ||  -  ||
    992 || {{{fill-opacity}}} || How transparent the fill is; applies to both color and image || ''Opacity'' ||  1.0  ||
    993 || {{{text-position}}} || set to {{{center}}}, if text should be drawn in the center of the area || {{{line}}}, {{{center}}} ||  -  ||
    994 || {{{text-...}}}, {{{font-...}}} ||||||  general text & font properties  ||
    995 Required properties to create an Area style: {{{fill-color}}} or {{{fill-image}}}
    996 
     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`) ||
     1088|| `casing-opacity` || How transparent the casing is. || ''Opacity'' ||  1.0  ||
     1089|| `casing-`... || ... || ... ||  ...  ||
     1090Similar 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.
     1091
     1092=== Area styles ===#AreaStyles
     1093||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
     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'' ||  -  ||
     1095|| `fill-image` || Image pattern || ''Image'' ||  -  ||
     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'' ||  -  ||
     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'' ||  -  ||
     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)  ||
     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` ||  -  ||
     1100|| `text-...`, `font-...` ||||||  see general text & font properties  ||
     1101Required properties to create an Area style: `fill-color` or `fill-image`
    9971102
    9981103=== Text & Font properties ===
    999 {{{#!th align=left valign=top
     1104{{{#!th valign=top
    10001105'''Key'''
    10011106}}}
    1002 {{{#!th align=left valign=top
     1107{{{#!th valign=top
    10031108'''Description'''
    10041109}}}
    1005 {{{#!th align=left valign=top
     1110{{{#!th valign=top
    10061111'''Value Format'''
    10071112}}}
    1008 {{{#!th align=left valign=top
     1113{{{#!th valign=top
    10091114'''Default Value'''
    10101115}}}
    10111116|-------------------------------------------------------------------------------
    10121117{{{#!td align=left  valign=top
    1013 {{{text}}}  
     1118`text` 
    10141119}}}
    10151120{{{#!td align=left  valign=top
    1016 How to find the label text. No label is displayed, unless this instruction is present.
     1121How to find the label text.\\No label is displayed, unless this instruction is present.
    10171122}}}
    10181123{{{#!td align=left  valign=top
    1019 {{{auto}}}
    1020    Derive the text automatically. The default name tags are: "{{{name:}}}"+''<LANG>'', "{{{name}}}", "{{{int_name}}}", "{{{ref}}}", "{{{operator}}}", "{{{brand}}}" and "{{{addr:housenumber}}}".
    1021 
    1022    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.)
     1124`auto`
     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.)
    10231128
    10241129''String''
    1025    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.
    10261131
    10271132''Expressions''
    10281133  You can enter an expression to compute the text to be displayed. Examples:
    1029   * {{{eval("this is a static text")}}} - renderes a static text
    1030   * {{{eval(concat(tag("first"), "-", tag("second")))}}} - displays the concatenated tags "first" and "second"
    1031 
    1032 {{{""}}}
     1134  * `eval("this is a static text")` - renderes a static text
     1135  * `eval(concat(tag("first"), "-", tag("second")))` - displays \\ the concatenated tags "first" and "second"
     1136
     1137`""`
    10331138   To delete a previous set text.
    10341139}}}
     
    10371142}}}
    10381143|-------------------------------------------------------------------------------
    1039 || {{{text-color}}} || the text color || ''Color'' ||  {{{white}}} for lines and nodes, {{{#c0c0c0}}} for areas (JOSM "{{{text}}}" and "{{{areatext}}}" color preferences) ||
    1040 || {{{text-opacity}}} || how transparent the text is || ''Opacity'' ||  1.0  ||
    1041 || {{{text-offset-x}}} || shift the text horizontally, (not supported for text along line) || ''Number'' ||  0  ||
    1042 || {{{text-offset-y}}} (can also be written as {{{text-offset}}})  || shift the text vertically, positive values shift the text in upwards direction  || ''Number'' ||  0  ||
    1043 || {{{text-halo-radius}}} || size of text background border (to make text visible on background with a similar color) || ''Number'' ||  -  ||
    1044 || {{{text-halo-color}}} || color of the text halo || ''Color'' ||  complement of the text color  ||
    1045 || {{{text-halo-opacity}}} || transparency for the text halo || ''Opacity'' ||  1.0  ||
    1046 || {{{font-family}}} || font family || ''String'' ||  "Helvetica"[[br]](JOSM preference "mappaint.font")  ||
    1047 || {{{font-size}}} || font size || ''Number'' ||  8[[br]](JOSM preference "mappaint.fontsize")  ||
    1048 || {{{font-weight}}} || bold or not || {{{bold}}}, {{{normal}}} ||  {{{normal}}}  ||
    1049 || {{{font-style}}} || italic or not || {{{italic}}}, {{{normal}}} ||  {{{normal}}}  ||
    1050 
     1144|| `text-color` || the text color || ''Color'' ||  `white` for lines and nodes,\\`#c0c0c0` for areas \\(JOSM "`text`" and "`areatext`"\\color preferences) ||
     1145|| `text-opacity` || how transparent the text is || ''Opacity'' ||  1.0  ||
     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'' ||  -  ||
     1149|| `text-halo-color` || color of the text halo || ''Color'' ||  complement of the text color  ||
     1150|| `text-halo-opacity` || transparency for the text halo || ''Opacity'' ||  1.0  ||
     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`")  ||
     1157|| `font-weight` || bold or not || `bold`, `normal` ||  `normal`  ||
     1158|| `font-style` || italic or not || `italic`, `normal` ||  `normal`  ||
     1159
     1160=== User defined properties ===
     1161* In [wikitr:/Styles Mappaint styles] you can define any custom property, e.g.: `crc: CRC32_checksum(tag(name))/429496.7296;`
     1162* In [wikitr:/Rules Validator rules] they must be prefixed by a `-`, e.g.: `-osmoseItemClassLevel: "1210/1/1";`
     1163
     1164=== Property values explanations === #Propertyvaluesexplanations
    10511165'' '''Width''' ''
    10521166 - 14.0 (any positive number)
    1053  - {{{default}}} (use JOSM's default line width, which is 2, but can be configured)
    1054  - {{{thinnest}}} (draws the line as thin as possible)
    1055  - +3 (with plus sign in front) adds the amount to the width on the default layer. This applies only for styles that are not on the default layer, e.g. highlights. Another way to write this would be {{{prop("width","default")+3}}}. For {{{casing-width}}}, this refers to the {{{width}}} value on the same layer.
     1167 - `default` (use JOSM's default line width, which is 2, but can be configured)
     1168 - `thinnest` (draws the line as thin as possible)
     1169 - +3 (with plus sign in front) adds the amount to the width on the default layer. This applies only for styles that are not on the default layer, e.g. highlights. Another way to write this would be `prop("width","default")+3`. For `casing-width`, this refers to the `width` value on the same layer.
    10561170
    10571171'' '''Image''' ''
    1058  See [wiki:Help/Styles/Images].
     1172 See [wikitr:/Help/Styles/Images].
    10591173
    10601174'' '''Color''' ''
    1061  * named color as found in [http://www.w3.org/TR/css3-color/#svg-color this] list
    1062  * html style: '''{{{#RRGGBB}}}''', '''{{{#RGB}}}''', '''{{{#RRGGBBAA}}}'''
    1063  * '''{{{rgb(/*r*/, /*g*/, /*b*/)}}}''' - rgb value with arguments from 0.0 to 1.0
    1064  * '''{{{rgba(/*r*/, /*g*/, /*b*/, /*alpha*/)}}}''' - rgb value with alpha
    1065  * '''{{{hsb_color(/*hue*/, /*saturation*/, /*brightness*/)}}}''' - color from HSB color space
     1175 * named color as found in [https://www.w3.org/TR/css3-color/#svg-color this] list
     1176 * html style: '''`#RRGGBB`''', '''`#RGB`''', '''`#RRGGBBAA`'''
     1177 * '''`rgb(/*r*/, /*g*/, /*b*/)`''' - rgb value with arguments from 0.0 to 1.0
     1178 * '''`rgba(/*r*/, /*g*/, /*b*/, /*alpha*/)`''' - rgb value with alpha
     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
    10661181
    10671182'' '''Opacity''' ''
     
    10691184
    10701185'' '''String''' ''
    1071  * any character sequence, in quotes, e.g. {{{"images/fill.png"}}}. If the string is an identifier, quotes are optional. (Quote and backslash sign can be escaped.)
     1186 * any character sequence, in quotes, e.g. `"images/fill.png"`. If the string is an identifier, quotes are optional. (Quote and backslash sign can be escaped.)
    10721187
    10731188'' '''Number''' ''
     
    10751190 * has a special meaning if you put a "+" sign in front (relative width)
    10761191
    1077 == Eval expressions ==
    1078 
    1079 
    1080 See [/doc/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.Functions.html#method_summary Javadoc of Functions] for the up-to-date list of functions supported by JOSM's MapCSS implementation.
     1192
     1193== Eval expressions ==#Evalexpressions
     1194See [/doc/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.html#method_summary Javadoc of Functions] for the up-to-date list of functions supported by JOSM's MapCSS implementation.
    10811195
    10821196 +, -, *, /::
     
    10841198 ||, &&, !::
    10851199  boolean operations
    1086  <, >, <=, >=, ==::
     1200 <, >, <=, >=, ==, !=::
    10871201  comparison operators
    1088  asin, atan, atan2, ceil, cos, cosh, exp, floor, log, max, min, random, round, signum, sin, sinh, sqrt, tan, tanh::
    1089   the usual meaning, [http://download.oracle.com/javase/7/docs/api/java/lang/Math.html details]
     1202 asin, atan, atan2, ceil, cos, cosh, exp, floor, log, max, min, mod (since r17759), random, round, signum, sin, sinh, sqrt, tan, tanh::
     1203  the usual meaning, [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html details]
    10901204 cond(b, fst, snd)::
    10911205 b ? fst : snd::
    10921206  if ('''b''') then '''fst''' else '''snd'''
    10931207 list(a, b, ...)::
    1094   create list of values, e.g. for the {{{dashes}}} property
     1208  create list of values, e.g. for the `dashes` property
    10951209 get(lst, n)::
    1096   get the ''n''th element of the list ''lst'' (counting starts at 0) [''since 5699'']
     1210  get the ''n''th element of the list ''lst'' (counting starts at 0) [''since r5699'']
    10971211 split(sep, str)::
    1098   splits string ''str'' at occurrences of the separator string ''sep'', returns a list [''since 5699'']
     1212  splits string ''str'' at occurrences of the separator string ''sep'', returns a list [''since r5699'']
    10991213 prop(''p_name'')::
    1100   value of the property ''p_name'' of the current layer, e.g. prop({{{"width"}}})
     1214  value of the property ''p_name'' of the current layer, e.g. prop(`"width"`)
    11011215 prop(''p_name'', ''layer_name'')::
    11021216  property from the layer ''layer_name''
     
    11101224  get the value of the key ''key_name'' from the object's parent
    11111225 parent_tags(''key_name'')::
    1112   returns all parent's values for the key ''key_name'' as a list ordered by a natural ordering [''since 8775'']
     1226  returns all parent's values for the key ''key_name'' as a list ordered by a natural ordering [''since r8775'']
    11131227 has_tag_key(''key_name'')::
    11141228  true, if the object has a tag with the given key
     
    11161230  create color value (arguments from 0.0 to 1.0)
    11171231 hsb_color(''h'', ''s'', ''b'')::
    1118   create color from hue, saturation and brightness (arguments from 0.0 to 1.0) [''since 6899'']
     1232  create color from hue, saturation and brightness (arguments from 0.0 to 1.0) [''since r6899'']
    11191233 red(''clr''), green(''clr''), blue(''clr'')::
    11201234  get value of color channels in rgb color model
    11211235 alpha(''clr'')::
    1122   get the alpha value of the given color [''since 6749'']
     1236  get the alpha value of the given color [''since r6749'']
    11231237 length(''str'')::
    11241238  length of a string
    11251239 count(''lst'')::
    1126   length of a list, i.e., counts its elements [''since 7162'']
     1240  length of a list, i.e., counts its elements [''since r7162'']
    11271241 length(''lst'')::
    1128   length of a list [''since 5699''] – deprecated ''since 7162''
     1242  length of a list ([''since r5699''] – deprecated ''since r7162''
    11291243 any(obj1, obj2, ...)::
    1130   returns the first object which is not null (formerly coalesce, [''since 7164''])
     1244  returns the first object which is not null (formerly coalesce, [''since r7164''])
    11311245 concat(''str1'', ''str2'', ...)::
    11321246  assemble the strings to one
    11331247 join(''sep'', ''str1'', ''str2'', ...)::
    1134   join strings, whith ''sep'' as separator [''since 6737'']
     1248  join strings, with ''sep'' as separator [''since r6737'']
    11351249 join_list(''sep'', ''list_name'')::
    1136    joins the elements of the list ''list_name'' to one string separated by the separator ''sep'' [''since 8775'']
     1250   joins the elements of the list ''list_name'' to one string separated by the separator ''sep'' [''since r8775'']
     1251 upper(''str'')::
     1252   converts string to upper case [''since r11756'']
     1253 lower(''str'')::
     1254   converts string to lower case [''since r11756'']
     1255 title(''str'')::
     1256   converts string to title case [''since r17613''] (`"i am FINE"` → `"I Am Fine"`)
     1257 trim(''str'')::
     1258   remove leading and trailing whitespace from string [''since r11756'']
     1259 trim_list(''list_name'')::
     1260   remove leading and trailing whitespace from a list of strings, will remove entries that are empty afterwards [''since r15591'']
    11371261 JOSM_search("...")::
    11381262  true, if JOSM search applies to the object
    11391263 tr(str, arg0, arg1, ...)::
    1140   translate from English to the current language (only for strings in the JOSM user interface) [''since 6506'']
     1264  translate from English to the current language (only for strings in the JOSM user interface) [''since r6506'']
    11411265 regexp_test(regexp, string)::
    1142   test if ''string'' matches pattern ''regexp'' [''since 5699'']
     1266  test if ''string'' matches pattern ''regexp'' [''since r5699'']
    11431267 regexp_test(regexp, string, flags)::
    1144   test if ''string'' matches pattern ''regexp''; flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since 5699'']
     1268  test if ''string'' matches pattern ''regexp''; flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since r5699'']
    11451269 regexp_match(regexp, string)::
    1146   Tries to match ''string'' against pattern ''regexp''. Returns a list of capture groups in case of success. The first element (index 0) is the complete match (i.e. ''string''). Further elements correspond to the bracketed parts of the regular expression. [''since 5701'']
     1270  Tries to match ''string'' against pattern ''regexp''. Returns a list of capture groups in case of success. The first element (index 0) is the complete match (i.e. ''string''). Further elements correspond to the bracketed parts of the regular expression. [''since r5701'']
    11471271 regexp_match(regexp, string, flags)::
    1148   Tries to match ''string'' against pattern ''regexp''. Returns a list of capture groups in case of success. The first element (index 0) is the complete match (i.e. ''string''). Further elements correspond to the bracketed parts of the regular expression. Flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since 5701'']
     1272  Tries to match ''string'' against pattern ''regexp''. Returns a list of capture groups in case of success. The first element (index 0) is the complete match (i.e. ''string''). Further elements correspond to the bracketed parts of the regular expression. Flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since r5701'']
    11491273 substring(str, idx)::
    1150   return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since 6534'']
     1274  return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since r6534'']
    11511275 substring(str, start, end)::
    1152   return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since 6534'']
     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'']
    11531277 replace(string, old, new)::
    11541278   Replaces any occurrence of the substring ''old'' within the string ''string'' with the text ''new''
    11551279 osm_id()::
    1156   returns the OSM id of the current object [''since 5699'']
     1280  returns the OSM id of the current object [''since r5699'']
     1281 osm_user_name()::
     1282  returns the OSM user name who last touched the current object [''since r15246'']
     1283 osm_user_id()::
     1284  returns the OSM user id who last touched the current object [''since r15246'']
     1285 osm_version()::
     1286  returns the OSM version number of the current object [''since r15246'']
     1287 osm_changeset_id()::
     1288  returns the id of the changeset the current object was last uploaded to [''since r15246'']
     1289 osm_timestamp()::
     1290  returns the time of last modification to the current object, as timestamp [''since r15246'']
     1291 parent_osm_id()::
     1292  returns the OSM id of the object's parent (matched by child selector) [''since r13094'']
    11571293 URL_encode(str)::
    1158   [https://en.wikipedia.org/wiki/Percent-encoding percent-encode] a string. May be useful for data URLs [''since 6805'']
     1294  [https://en.wikipedia.org/wiki/Percent-encoding percent-encode] a string. May be useful for data URLs [''since r6805'']
     1295 URL_decode(str)::
     1296  [https://en.wikipedia.org/wiki/Percent-encoding percent-decode] a string. [''since r11756'']
    11591297 XML_encode(str)::
    1160   escape special characters in xml. E.g. {{{<}}} becomes {{{&lt;}}}, other special characters: {{{>}}}, {{{"}}}, {{{'}}}, {{{&}}}, {{{\n}}}, {{{\t}}} and {{{\r}}} [''since 6809'']
     1298  escape special characters in xml. E.g. `<` becomes `&lt;`, other special characters: `>`, `"`, `'`, `&`, `\n`, `\t` and `\r` [''since r6809'']
    11611299 CRC32_checksum(''str'')::
    1162   calculate the CRC32 checksum of a string (result is an integer from 0 to 2^32^-1) [''since 6908'']
    1163  is_right_hand_traffic() [''since 7193'']::
    1164   Check if there is left-hand or right-hand traffic at the current location.
    1165  number_of_tags() [''since 7237'']::
    1166   returns the number of tags for the current OSM object
    1167  print(o) [''since 7237'']::
    1168   prints a string representation of `o` to the command line (for debugging)
    1169  println(o) [''since 7237'']::
    1170   prints a string representation of `o` to the command line, followed by a new line (for debugging)
    1171  JOSM_pref(''key'', ''default'') [''since 7238, with restrictions since 3856'']::
    1172   Get value from the JOSM advanced preferences. This way you can offer certain options to the user and make the style customizable. It works with strings, numbers, colors and boolean values. [[br]][This function exists since version 3856, but with some restrictions. `JOSM_pref` always returns a string, but in version 7237 and earlier, the automatic conversion of string to boolean and color was not working. You can use the following workarounds for boolean values and color in version 7237 and earlier: `cond(JOSM_pref("myprefkey", "true")="true", "X", "O")` and `html2color(JOSM_pref("mycolor", "#FF345611"))`. These explicit conversions should be no longer necessary in version 7238 and later. Automatic conversion to a number works in any version.]
    1173  setting() [''since 7450'']::
    1174   to use a [[Help/Styles/MapCSSImplementation#Stylesettings|style setting]]
    1175  degree_to_radians() [''since 8260'']::
    1176   returns a in degree given direction in radians
    1177  cardinal_to_radians() [''since 8260'']::
    1178   returns a cardinal direction in radians
    1179  waylength() [''since 8253'']::
    1180   returns the length of the way in metres
    1181  areasize() [''since 8253'']::
    1182   returns the area of a closed way in square meters
    1183  
    1184 
     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'']
     1303 is_right_hand_traffic()::
     1304  Check if there is left-hand or right-hand traffic at the current location. [''since r7193'']
     1305 number_of_tags()::
     1306  returns the number of tags for the current OSM object [''since r7237'']
     1307 print(o)::
     1308  prints a string representation of `o` to the command line (for debugging) [''since r7237'']
     1309 println(o)::
     1310  prints a string representation of `o` to the command line, followed by a new line (for debugging) [''since r7237'']
     1311 JOSM_pref(''key'', ''default'')::
     1312  Get value from the JOSM advanced preferences. This way you can offer certain options to the user and make the style customizable. It works with strings, numbers, colors and boolean values. \\[This function exists since version r3856, but with some restrictions. `JOSM_pref` always returns a string, but in version r7237 and earlier, the automatic conversion of string to boolean and color was not working. You can use the following workarounds for boolean values and color in version r7237 and earlier: `cond(JOSM_pref("myprefkey", "true")="true", "X", "O")` and `html2color(JOSM_pref("mycolor", "#FF345611"))`. These explicit conversions should be no longer necessary in version r7238 and later. Automatic conversion to a number works in any version. Furthermore, in version r16590, can be used to set color properties. So `* { set_color: JOSM_pref("pref", #000000); }` will create a color property now.]
     1313 setting()::
     1314  to use a [wikitr:/Help/Styles/MapCSSImplementation#Stylesettings style setting] [''since r7450'']
     1315 degree_to_radians()::
     1316  returns a in degree given direction in radians [''since r8260'']
     1317 cardinal_to_radians()::
     1318  returns a cardinal direction in radians [''since r8260'']
     1319 waylength()::
     1320  returns the length of the way in metres [''since r8253'']
     1321 areasize()::
     1322  returns the area of a closed way in square meters [''since r8253'']
     1323 at(lat,lon)::
     1324  returns true if the object centroid lies at given ''lat''/''lon'' coordinates, e.g. to check for nodes at "null island" `node[at(0.0,0.0)]` [''since r12514'']
     1325 is_similar(''str1'', ''str2'')::
     1326  returns true if the two strings are similar, but not identical, i.e., have a Levenshtein distance of 1 or 2. Example: `way[highway][name][is_similar(tag(name), "Main Street")]` checks for streets with a possible typo in the name (e.g. Main Streeg). [''since r14371'']
     1327 gpx_distance()::
     1328  returns the lowest distance between the OSM object and a GPX point [''since r14802'']
     1329 count_roles()::
     1330  returns the number of primitives in a relation with the specified roles [''since r15275'']
     1331 sort(''str1'', ''str2'', ''str3'', ''...'')::
     1332  sorts an array of strings [''since r15279'']
     1333 sort_list(''list_name'')::
     1334  sorts a list of strings [''since r15279'']
     1335 tag_regex(''regex'')::
     1336  returns a list containing the values of keys that match the regex [''since r15317'']
     1337 to_boolean(''str'')::
     1338  returns the string argument as a boolean [''since r16110'']
     1339 to_byte(''str'')::
     1340  returns the string argument as a byte [''since r16110'']
     1341 to_short(''str'')::
     1342  returns the string argument as a short [''since r16110'']
     1343 to_int(''str'')::
     1344  returns the string argument as a int [''since r16110'']
     1345 to_long(''str'')::
     1346  returns the string argument as a long [''since r16110'']
     1347 to_float(''str'')::
     1348  returns the string argument as a float [''since r16110'']
     1349 to_double(''str'')::
     1350  returns the string argument as a double [''since r16110'']
     1351 uniq(''str1'', ''str2'', ''str3'', ''...'')::
     1352  returns a list of strings that only have unique values from an array of strings [''since r15323'']
     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'']
    11851363
    11861364=== Examples ===
    1187 
    11881365* circle symbol for house number with size depending of the number of digits
    11891366{{{
     
    12431420}}}
    12441421
     1422* casing on inside of area
     1423{{{
     1424#!mapcss
     1425area[building]:clockwise {
     1426    right-casing-width: 10;
     1427}
     1428area[building]:anticlockwise {
     1429    left-casing-width: 10;
     1430}
     1431/* or */
     1432area[building][is_clockwise()] {
     1433    right-casing-width: 10;
     1434}
     1435area[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
     1443way[/(?i)^name$/ =~ /(?i)^Main Street$/] {
     1444}
     1445}}}
     1446
    12451447
    12461448== Compatibility notes ==
    12471449=== MapCSS 0.2 ===
    1248 
    12491450==== Grammar ====
    1250 
    1251  * {{{way[oneway=yes]}}} does not have any magic, you can use {{{way[oneway?]}}} instead
    1252  * no {{{@import}}}
    1253  * JOSM does not require {{{eval(...)}}} to be wrapped around expressions, but for compatibility with other MapCSS implementations you should write it out.
     1451 * `way[oneway=yes]` does not have any magic, you can use `way[oneway?]` instead
     1452 * no `@import`
     1453 * JOSM does not require `eval(...)` to be wrapped around expressions, but for compatibility with other MapCSS implementations you should write it out.
    12541454
    12551455==== Properties ====
    12561456At the moment, JOSM does ''not'' support the following properties:
    12571457 line: ::
    1258   {{{image}}}
     1458  `image`
    12591459 label: ::
    1260   {{{font-variant, text-decoration, text-transform, max-width}}}
     1460  `font-variant, text-decoration, text-transform, max-width`
    12611461 shield: ::
    12621462  not supported
    12631463
    12641464=== Halcyon (Potlatch 2) ===
    1265 
    12661465 * Text label is placed in the center of the icon. For compatibility with Halcyon put
    12671466{{{
     
    12711470 at the beginning of your style sheet.
    12721471 * standard z-index in Halcyon is 5, but it is 0 in JOSM
    1273  * '''{{{image: circle;}}}''' corresponds to '''{{{symbol-shape: circle;}}}'''
     1472 * '''`image: circle;`''' corresponds to '''`symbol-shape: circle;`'''
    12741473
    12751474=== Kothic ===
    1276 
    12771475 * Kothic has support for eval, which probably differs from JOSM's eval.
    12781476 * Kothic understands units, whereas JOSM always calculates in pixel.
    1279  * The extrusion features are not available in JOSM
     1477 * The extrusion features are not available in JOSM.
    12801478
    12811479=== Ceyx ===
    1282 
    1283  * seems to have {{{[tunnel=1]}}} instead of {{{[tunnel=yes]}}} (Halcyon) or {{{[tunnel?]}}} (JOSM)
    1284 
    1285 == See also ==
    1286  * [wiki:Help/Validator/MapCSSTagChecker MapCSSTagChecker]
    1287  * [wiki:Styles Styles]
     1480 * seems to have `[tunnel=1]` instead of `[tunnel=yes]` (Halcyon) or `[tunnel?]` (JOSM)
     1481
     1482
     1483== Media queries (deprecated) ==
     1484
     1485{{{#!td style="background-color: #faa"
     1486Note: media queries are deprecated. You should use @supports rules instead (see above).
     1487}}}
     1488Media queries are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. This feature came with r6970. Example:
     1489{{{
     1490#!mapcss
     1491@media (min-josm-version: 9789) {
     1492    way[highway] {
     1493        width: 4;
     1494        color: orange;
     1495    }
     1496    /* fancy new stuff */
     1497    /* ... */
     1498}
     1499
     1500@media (max-josm-version: 9788) {
     1501    way[highway] {
     1502        width: 4;
     1503        color: blue;
     1504    }
     1505    /* fall back mode, using more simple features */
     1506    /* ... */
     1507}
     1508}}}
     1509
     1510The syntax closely matches the official [https://www.w3.org/TR/css3-mediaqueries/#syntax css syntax]. The following conditions are supported:
     1511
     1512{{{#!th
     1513'''Media condition'''
     1514}}}
     1515{{{#!th
     1516'''Description'''
     1517}}}
     1518|-
     1519{{{#!td
     1520(min-josm-version: ''<number>'')
     1521}}}
     1522{{{#!td
     1523Only include `@media` section when the current version of JOSM is greater than or equal to the specified number.
     1524}}}
     1525|-
     1526{{{#!td
     1527(max-josm-version: ''<number>'')
     1528}}}
     1529{{{#!td
     1530Only include `@media` section when the current version of JOSM is lower than or equal to the specified number.
     1531}}}
     1532|-
     1533{{{#!td
     1534(user-agent: ''<string>'')
     1535}}}
     1536{{{#!td
     1537Only include `@media` section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is `josm`.
     1538}}}
     1539
     1540Conditions can be combined with `and`:
     1541
     1542{{{
     1543#!mapcss
     1544@media (min-josm-version: 6970) and (max-josm-version: 7014) {
     1545 /* only for JOSM versions 6970 to 7014 */
     1546}
     1547}}}
     1548
     1549Multiple combined conditions can be chained with a comma (logical ''or''):
     1550
     1551{{{
     1552#!mapcss
     1553@media (min-josm-version: 6970) and (max-josm-version: 7014), (user-agent: myEditor) {
     1554  /* for JOSM version 6970 to 7014 and for the editor called "myEditor" */
     1555}
     1556}}}
     1557
     1558Since media queries are only supported in JOSM 6970 and later, you should also specify this as minimum JOSM version in the meta selector:
     1559
     1560{{{
     1561#!mapcss
     1562meta {
     1563    min-josm-version: "6970"; /* This style uses media queries */
     1564    /* ... */
     1565}
     1566}}}
     1567
     1568
     1569{{{#!comment
     1570There is also the `not` keyword (see the linked css doc for details).
     1571This is implemented, but probably not very useful. Feel free to add documentation.
     1572}}}