Changes between Version 3 and Version 4 of Help/Styles/MapCSSImplementation


Ignore:
Timestamp:
2011-03-07T16:12:38+01:00 (15 years ago)
Author:
bastiK
Comment:

add toc

Legend:

Unmodified
Added
Removed
Modified
  • Help/Styles/MapCSSImplementation

    v3 v4  
    11This page documents details on JOSM's [http://wiki.openstreetmap.org/wiki/MapCSS/0.2 MapCSS] implementation. At the moment (Feb-2011) it is under active development and anything may change without warning.
    2 
    3 = General Structure =
     2[[TOC(inline)]]
     3== General Structure ==
    44A MapCSS style sheet has rules of the form
    55{{{
     
    1717}}}
    1818
    19 = Selectors =
     19== Selectors ==
    2020Examples for selectors are
    2121{{{
     
    2727The different elements ('''type'''-, '''zoom'''- , '''condition''' selector, '''pseudo classes''', '''layer identifier''', '''grouping''' and '''child combinator''') are explained below.
    2828
    29 == Type selector ==
     29=== Type selector ===
    3030 {{{node}}}, {{{way}}}, {{{relation}}}::
    3131  applies to the osm objects of the given type
     
    5858}}}
    5959
    60 == Zoom selector ==
     60=== Zoom selector ===
    6161You can restrict the scale at that the a given rule applies.
    6262|| {{{way|z12 {...}}}} || At zoom level 12 ||
     
    6767The precise definition of scale ranges for each zoom level may change in future. By rule of thumb you can expect to be approximately at zoom level ''n'' when imagery displays slippymap tiles of level ''n''.
    6868
    69 == Condition selector ==
     69=== Condition selector ===
    7070You can add any number of conditions, which must all be fulfilled, otherwise the block of declarations will not be executed for that object. Possible conditions are:
    7171
     
    8585|| {{{node[eval(JOSM_search("role:forward_stop | role:backward_stop"))]}}} || JOSM search expression - in this case any node that is member of a relation as {{{forward_stop}}} or {{{backward_stop}}} ||
    8686
    87 == Pseudo Classes ==
     87=== Pseudo Classes ===
    8888
    8989|| {{{:closed}}} || true for ways where the first node is the same as the last and for any multipolygon relation ||
     
    9393|| {{{: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.) ||
    9494}}}
    95 == Layer Identifier ==
     95=== Layer Identifier ===
    9696
    9797Layers can be used to create more than one style for a single object. Here is an example:
     
    163163}}}
    164164
    165 == Child combinator ==
     165=== Child combinator ===
    166166You can select nodes that are part of specific ways and any object that is member of a certain relation:
    167167{{{
     
    170170Zoom selector and Layer identifier are only relevant for the part right of the ">" sign.
    171171
    172 == Grouping ==
     172=== Grouping ===
    173173
    174174Rules with common declaration block can be grouped into one:
     
    186186
    187187
    188 = Properties =
    189 
    190 
    191 
    192 == General properties ==
     188== Properties ==
     189
     190
     191
     192=== General properties ===
    193193
    194194||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
     
    208208
    209209
    210 == Icon and symbol styles ==
     210=== Icon and symbol styles ===
    211211
    212212||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
     
    230230
    231231
    232 == Line styles ==
     232=== Line styles ===
    233233||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    234234|| {{{width}}} || Line width || ''Width'' ||  -  ||
     
    251251|| {{{casing-}}}... || ... || ... ||  ...  ||
    252252
    253 == Area styles == 
     253=== Area styles ===
    254254||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
    255255|| {{{fill-color}}} || Color in which to fill the area || ''Color'' ||  -  ||
     
    260260Required properties to create an Area style: {{{fill-color}}} or {{{fill-image}}}
    261261
    262 == Text & Font properties ==
     262=== Text & Font properties ===
    263263
    264264||=  '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =||
     
    296296
    297297
    298 = Eval expressions =
     298== Eval expressions ==
    299299
    300300
     
    345345
    346346
    347 == Examples == 
     347=== Examples ===
    348348
    349349* circle symbol for house number with size depending of the number of digits
     
    387387
    388388
    389 = Compatibility notes =
    390 == MapCSS 0.2 ==
    391 
    392 === Grammar ===
     389== Compatibility notes ==
     390=== MapCSS 0.2 ===
     391
     392==== Grammar ====
    393393
    394394 * descendant combinator is not supported, use child combinator instead.
     
    411411 * JOSM does not require {{{eval(...)}}} to be wrapped around expressions, but for compatibility with other MapCSS implementations you should write it out.
    412412
    413 === Properties ===
     413==== Properties ====
    414414At the moment, JOSM does not support the following properties:
    415415 canvas: ::
     
    426426JOSM uses the MapCSS 0.1 way to specify {{{casing-width}}}, i.e. '''{{{casing-width: 9;}}}''' is an absolute value. You can write '''{{{casing-width: +4;}}}''' to specify a 2px casing on both sides.
    427427
    428 == Halcyon (Potlatch 2) ==
     428=== Halcyon (Potlatch 2) ===
    429429
    430430 * Text label is placed in the center of the icon. For compatibility with Halcyon put
     
    436436 * '''{{{image: circle;}}}''' corresponds to '''{{{symbol-shape: circle;}}}'''
    437437
    438 == Kothic ==
     438=== Kothic ===
    439439
    440440 * Kothic has support for eval, which probably differs from JOSM's eval.
     
    442442 * The extrusion features are not available in JOSM
    443443
    444 == Ceyx ==
     444=== Ceyx ===
    445445
    446446 * seems to have {{{[tunnel=1]}}} instead of {{{[tunnel=yes]}}} (Halcyon) or {{{[tunnel?]}}} (JOSM)