Changes between Version 177 and Version 178 of Help/Styles/MapCSSImplementation
- Timestamp:
- 2020-06-10T18:04:09+02:00 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v177 v178 66 66 === Type selector === 67 67 68 {{{#!th align=leftvalign=top68 {{{#!th valign=top 69 69 '''Selector''' 70 70 }}} 71 {{{#!th align=leftvalign=top71 {{{#!th valign=top 72 72 '''Description''' 73 73 }}} 74 74 |------------------------------------------------------------------------------- 75 {{{#!td align= leftvalign=top75 {{{#!td align=center valign=top 76 76 * 77 77 }}} … … 80 80 }}} 81 81 |------------------------------------------------------------------------------- 82 {{{#!td align= leftvalign=top82 {{{#!td align=center valign=top 83 83 {{{node}}}, {{{way}}}, {{{relation}}} 84 84 }}} … … 87 87 }}} 88 88 |------------------------------------------------------------------------------- 89 {{{#!td align= leftvalign=top89 {{{#!td align=center valign=top 90 90 {{{area}}} 91 91 }}} … … 101 101 }}} 102 102 |------------------------------------------------------------------------------- 103 {{{#!td align= leftvalign=top103 {{{#!td align=center valign=top 104 104 {{{meta}}} 105 105 }}} … … 120 120 }}} 121 121 |------------------------------------------------------------------------------- 122 {{{#!td align= leftvalign=top122 {{{#!td align=center valign=top 123 123 {{{canvas}}} 124 124 }}} … … 146 146 }}} 147 147 |- 148 {{{#!td 148 {{{#!td align=center 149 149 {{{fill-color}}} 150 150 }}} … … 152 152 Specifies the overall fill/background color (`background-color` is deprecated since r7110). 153 153 }}} 154 {{{#!td 154 {{{#!td align=center 155 155 ''Color'' 156 156 }}} … … 159 159 }}} 160 160 |- 161 {{{#!td 161 {{{#!td align=center 162 162 {{{default-points}}} 163 163 }}} … … 165 165 Whether default point style should be added to nodes where no style applies. 166 166 }}} 167 {{{#!td 167 {{{#!td align=center 168 168 ''Boolean'' 169 169 }}} … … 172 172 }}} 173 173 |- 174 {{{#!td 174 {{{#!td align=center 175 175 {{{default-lines}}} 176 176 }}} … … 178 178 Whether default line style should be added to ways where no style applies. 179 179 }}} 180 {{{#!td 180 {{{#!td align=center 181 181 ''Boolean'' 182 182 }}} … … 231 231 232 232 [=#condition_selector_operators] 233 {{{#!th align=leftvalign=top233 {{{#!th valign=top 234 234 '''Operator''' 235 235 }}} 236 {{{#!th align=leftvalign=top236 {{{#!th valign=top 237 237 '''Description''' 238 238 }}} 239 {{{#!th align=leftvalign=top239 {{{#!th valign=top 240 240 '''Example''' 241 241 }}} 242 242 |------------------------------------------------------------------------------- 243 {{{#!td align= leftvalign=top243 {{{#!td align=center valign=top 244 244 `=` 245 245 }}} … … 256 256 }}} 257 257 |------------------------------------------------------------------------------- 258 {{{#!td align= leftvalign=top258 {{{#!td align=center valign=top 259 259 `!=` 260 260 }}} … … 271 271 }}} 272 272 |------------------------------------------------------------------------------- 273 {{{#!td align= leftvalign=top273 {{{#!td align=center valign=top 274 274 `<`, `>`, `<=`, `>=` 275 275 }}} … … 286 286 }}} 287 287 |------------------------------------------------------------------------------- 288 {{{#!td align= leftvalign=top288 {{{#!td align=center valign=top 289 289 {{{^=}}} 290 290 }}} … … 299 299 }}} 300 300 |------------------------------------------------------------------------------- 301 {{{#!td align= leftvalign=top301 {{{#!td align=center valign=top 302 302 `$=` 303 303 }}} … … 312 312 }}} 313 313 |----------------------------------------------- 314 {{{#!td align= leftvalign=top314 {{{#!td align=center valign=top 315 315 `*=` 316 316 }}} … … 325 325 }}} 326 326 |------------------------------------------------------------------------------- 327 {{{#!td align= leftvalign=top327 {{{#!td align=center valign=top 328 328 `~=` 329 329 }}} … … 339 339 }}} 340 340 |------------------------------------------------------------------------------- 341 {{{#!td align= leftvalign=top341 {{{#!td align=center valign=top 342 342 `=~` 343 343 }}} … … 360 360 }}} 361 361 |------------------------------------------------------------------------------- 362 {{{#!td align= leftvalign=top362 {{{#!td align=center valign=top 363 363 `!~` (since r6455) 364 364 }}} … … 374 374 }}} 375 375 |------------------------------------------------------------------------------- 376 {{{#!td align= leftvalign=top377 `∈` ([http://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609) 376 {{{#!td align=center valign=top 377 `∈` ([https://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609) 378 378 }}} 379 379 {{{#!td align=left valign=top … … 394 394 }}} 395 395 |------------------------------------------------------------------------------- 396 {{{#!td align= leftvalign=top397 `⊆` ([http://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) 396 {{{#!td align=center valign=top 397 `⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) 398 398 }}} 399 399 {{{#!td align=left valign=top … … 412 412 }}} 413 413 |------------------------------------------------------------------------------- 414 {{{#!td align= leftvalign=top415 `⊇` ([http://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102) 414 {{{#!td align=center valign=top 415 `⊇` ([https://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102) 416 416 }}} 417 417 {{{#!td align=left valign=top … … 430 430 }}} 431 431 |------------------------------------------------------------------------------- 432 {{{#!td align= leftvalign=top433 `⊈` ([http://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102) 432 {{{#!td align=center valign=top 433 `⊈` ([https://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102) 434 434 }}} 435 435 {{{#!td align=left valign=top … … 448 448 }}} 449 449 |------------------------------------------------------------------------------- 450 {{{#!td align= leftvalign=top451 `⊉` ([http://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) 450 {{{#!td align=center valign=top 451 `⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) 452 452 }}} 453 453 {{{#!td align=left valign=top … … 466 466 }}} 467 467 |------------------------------------------------------------------------------- 468 {{{#!td align= leftvalign=top469 `⧉` ([http://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) 468 {{{#!td align=center valign=top 469 `⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) 470 470 }}} 471 471 {{{#!td align=left valign=top … … 487 487 In addition, you can test whether a tag is present or not: 488 488 489 {{{#!th align=leftvalign=top489 {{{#!th valign=top 490 490 '''Condition''' 491 491 }}} 492 {{{#!th align=leftvalign=top492 {{{#!th valign=top 493 493 '''Example''' 494 494 }}} … … 539 539 "yes", "true", or "1". All other values are evaluated to false. 540 540 541 {{{#!th align=leftvalign=top541 {{{#!th valign=top 542 542 '''Condition''' 543 543 }}} 544 {{{#!th align=leftvalign=top544 {{{#!th valign=top 545 545 '''Example''' 546 546 }}} … … 594 594 }}} 595 595 596 {{{#!th align=leftvalign=top596 {{{#!th valign=top 597 597 '''Operator''' 598 598 }}} 599 {{{#!th align=leftvalign=top599 {{{#!th valign=top 600 600 '''Description''' 601 601 }}} 602 {{{#!th align=leftvalign=top602 {{{#!th valign=top 603 603 '''Example''' 604 604 }}} 605 605 |------------------------------------------------------------------------------- 606 {{{#!td align= leftvalign=top606 {{{#!td align=center valign=top 607 607 `=` 608 608 }}} … … 644 644 at which the respective MapCSS rule is applied. 645 645 646 {{{#!th align= leftvalign=top646 {{{#!th align=center valign=top 647 647 '''Example''' 648 648 }}} 649 {{{#!th align= leftvalign=top649 {{{#!th align=center valign=top 650 650 '''Description''' 651 651 }}} … … 663 663 See [/doc/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.PseudoClasses.html Javadoc] for the up-to-date list of pseudo classes supported by JOSM's MapCSS implementation. 664 664 665 ||= Class =||= Description =|| 665 666 || {{{:closed}}} || true for ways where the first node is the same as the last and for any (completely downloaded) multipolygon relation || 666 667 || {{{:closed2}}} || same as above, but this one ignores if a multipolygon is downloaded completely (since r9099) || … … 780 781 781 782 === Grouping === 782 783 783 Rules with common declaration block can be grouped into one: 784 784 {{{ … … 821 821 You can also negate classes. E.g. {{{way!.path}}} for all ways, which are not part of the class ''.path''. 822 822 823 == @supports rule for conditional processing [''since 8087''] == 824 823 824 == @supports rule for conditional processing [''since r8087''] == 825 825 @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: 826 826 {{{ … … 907 907 }}} 908 908 909 Since @supports rules are only supported in JOSM 8087 and later, you should also specify this as minimum JOSM version in the meta selector: 909 Since @supports rules are only supported in JOSM r8087 and later, you should also specify this as minimum JOSM version in the meta selector: 910 910 911 911 {{{ … … 1018 1018 1019 1019 ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| 1020 || {{{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 ||1021 || {{{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||1020 || {{{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 || 1021 || {{{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 || 1022 1022 || {{{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 || 1023 1023 || {{{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 || … … 1036 1036 || `icon-offset-y` || Shift the icon in vertical direction (positive values downwards) (since r8085) || ''Number'' || 0 || 1037 1037 || `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`. || - || 1038 || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || {{{center}}}, {{{inside}}}, {{{line}}} || {{{center}}} || 1039 || {{{symbol-shape}}} || Display a symbol at the position of the node || {{{square}}}, {{{circle}}}, {{{triangle}}}, {{{pentagon}}}, {{{hexagon}}}, {{{heptagon}}}, {{{octagon}}}, {{{nonagon}}}, {{{decagon}}} || - ||1038 || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || {{{center}}}, {{{inside}}}, {{{line}}} || {{{center}}} || 1039 || {{{symbol-shape}}} || Display a symbol at the position of the node || {{{square}}}, {{{circle}}}, {{{triangle}}}, {{{pentagon}}}, {{{hexagon}}}, {{{heptagon}}}, {{{octagon}}}, {{{nonagon}}}, {{{decagon}}} || - || 1040 1040 || {{{symbol-size}}} || Size of the symbol || ''Number'', can be relative ("+4") || 10 || 1041 || {{{symbol-stroke-width}}} || outline stroke width || ''Width'' || 1.0 if {{{symbol-stroke-color}}} is set||1041 || {{{symbol-stroke-width}}} || outline stroke width || ''Width'' || 1.0 if {{{symbol-stroke-color}}} is set || 1042 1042 || {{{symbol-stroke-color}}} || line color || ''Color'' || {{{#FFC800}}} if {{{symbol-stroke-width}}} is set || 1043 1043 || {{{symbol-stroke-opacity}}} || line opacity || ''Opacity'' || 1.0 || 1044 1044 || {{{symbol-fill-color}}} || fill color for the shape || ''Color'' || {{{blue}}}, unless either {{{symbol-stroke-width}}} or {{{symbol-stroke-color}}} is set || 1045 || {{{symbol-fill-opacity}}} || fill opacity || ''Opacity'' || 1.0 || 1045 || {{{symbol-fill-opacity}}} || fill opacity || ''Opacity'' || 1.0 || 1046 1046 || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || 1047 1047 || {{{text-anchor-horizontal}}} || horizontal text label placement || {{{left}}}, {{{center}}}, {{{right}}} || {{{right}}} || 1048 1048 || {{{text-anchor-vertical}}} || vertical text label placement || {{{above}}}, {{{top}}}, {{{center}}}, {{{bottom}}}, {{{below}}} || {{{bottom}}} || 1049 || {{{text-rotation}}} || Rotate the text clockwise or anti clockwise (negative value)(since 16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); See also the functions `degree_to_radians`, `cardinal_to_radians`. (Note that the direction means where the upper edge of the text faces. That means with the default direction of north the text flows to east (with a left to right language). So if you want to flow it to e.g. south you need to set east.) || - || 1049 || {{{text-rotation}}} || Rotate the text clockwise or anti clockwise (negative value)(since r16253) || `[rad]`, `[rad]rad`, `[deg]°`, `[deg]deg`, `[grad]grad`, `[turn]turn` ([https://developer.mozilla.org/en/docs/Web/CSS/angle definition]) or a cardinal direction (e.g. `northeast` or `sw`); See also the functions `degree_to_radians`, `cardinal_to_radians`. (Note that the direction means where the upper edge of the text faces. That means with the default direction of north the text flows to east (with a left to right language). So if you want to flow it to e.g. south you need to set east.) || - || 1050 1050 1051 1051 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. … … 1070 1070 || {{{text-position}}} || set to {{{line}}}, if text should be drawn along the line || {{{line}}}, {{{center}}} || - || 1071 1071 || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || 1072 || `repeat-image` || repeated image along a line '' [since 5801]'' || ''Image'' || - ||1073 || `repeat-image-width` || Width of the image (optional, see `icon-width`) '' [since 5811]'' || ''Number'' || - ||1074 || `repeat-image-height` || Height of the image (optional) '' [since 5811]'' || ''Number'' || - ||1075 || `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` ||1076 || `repeat-image-offset` || Offset from the line '' [since 5801]'' || ''Number'' || 0 ||1077 || `repeat-image-spacing` || Spacing between repeated images '' [since 5801]'' || ''Number'' || 0 ||1078 || `repeat-image-phase` || Initial spacing at the beginning of the line '' [since 5812]'' || ''Number'' || 0 ||1072 || `repeat-image` || repeated image along a line ''(since r5801)'' || ''Image'' || - || 1073 || `repeat-image-width` || Width of the image (optional, see `icon-width`) ''(since r5811)'' || ''Number'' || - || 1074 || `repeat-image-height` || Height of the image (optional) ''(since r5811)'' || ''Number'' || - || 1075 || `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` || 1076 || `repeat-image-offset` || Offset from the line ''(since r5801)'' || ''Number'' || 0 || 1077 || `repeat-image-spacing` || Spacing between repeated images ''(since r5801)'' || ''Number'' || 0 || 1078 || `repeat-image-phase` || Initial spacing at the beginning of the line ''(since r5812)'' || ''Number'' || 0 || 1079 1079 1080 1080 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. … … 1090 1090 || {{{fill-color}}} || Color in which to fill the area. Until 11700, the alpha component was set to 50 to create a transparency effect. || ''Color'' || - || 1091 1091 || {{{fill-image}}} || Image pattern || ''Image'' || - || 1092 || {{{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'' || - ||1092 || {{{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'' || - || 1093 1093 || {{{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'' || - || 1094 || {{{fill-opacity}}} || How transparent the fill is; applies to both color and image || ''Opacity'' || 0.2 '' [since11700, 1.0 before that]'' (can be changed with the {{{mappaint.fillalpha}}} and {{{mappaint.fill-image-alpha}}} preferences) ||1095 || {{{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}}} || - ||1094 || {{{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) || 1095 || {{{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}}} || - || 1096 1096 || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || 1097 1097 Required properties to create an Area style: {{{fill-color}}} or {{{fill-image}}} … … 1099 1099 1100 1100 === Text & Font properties === 1101 {{{#!th align=leftvalign=top1101 {{{#!th valign=top 1102 1102 '''Key''' 1103 1103 }}} 1104 {{{#!th align=leftvalign=top1104 {{{#!th valign=top 1105 1105 '''Description''' 1106 1106 }}} 1107 {{{#!th align=leftvalign=top1107 {{{#!th valign=top 1108 1108 '''Value Format''' 1109 1109 }}} 1110 {{{#!th align=leftvalign=top1110 {{{#!th valign=top 1111 1111 '''Default Value''' 1112 1112 }}} … … 1201 1201 create list of values, e.g. for the {{{dashes}}} property 1202 1202 get(lst, n):: 1203 get the ''n''th element of the list ''lst'' (counting starts at 0) [''since 5699''] 1203 get the ''n''th element of the list ''lst'' (counting starts at 0) [''since r5699''] 1204 1204 split(sep, str):: 1205 splits string ''str'' at occurrences of the separator string ''sep'', returns a list [''since 5699''] 1205 splits string ''str'' at occurrences of the separator string ''sep'', returns a list [''since r5699''] 1206 1206 prop(''p_name''):: 1207 1207 value of the property ''p_name'' of the current layer, e.g. prop({{{"width"}}}) … … 1217 1217 get the value of the key ''key_name'' from the object's parent 1218 1218 parent_tags(''key_name''):: 1219 returns all parent's values for the key ''key_name'' as a list ordered by a natural ordering [''since 8775''] 1219 returns all parent's values for the key ''key_name'' as a list ordered by a natural ordering [''since r8775''] 1220 1220 has_tag_key(''key_name''):: 1221 1221 true, if the object has a tag with the given key … … 1223 1223 create color value (arguments from 0.0 to 1.0) 1224 1224 hsb_color(''h'', ''s'', ''b''):: 1225 create color from hue, saturation and brightness (arguments from 0.0 to 1.0) [''since 6899''] 1225 create color from hue, saturation and brightness (arguments from 0.0 to 1.0) [''since r6899''] 1226 1226 red(''clr''), green(''clr''), blue(''clr''):: 1227 1227 get value of color channels in rgb color model 1228 1228 alpha(''clr''):: 1229 get the alpha value of the given color [''since 6749''] 1229 get the alpha value of the given color [''since r6749''] 1230 1230 length(''str''):: 1231 1231 length of a string … … 1233 1233 length of a list, i.e., counts its elements [''since 7162''] 1234 1234 length(''lst''):: 1235 length of a list [''since 5699''] – deprecated ''since 7162'' 1235 length of a list ([''since r5699''] – deprecated ''since r7162'' 1236 1236 any(obj1, obj2, ...):: 1237 returns the first object which is not null (formerly coalesce, [''since 7164'']) 1237 returns the first object which is not null (formerly coalesce, [''since r7164'']) 1238 1238 concat(''str1'', ''str2'', ...):: 1239 1239 assemble the strings to one 1240 1240 join(''sep'', ''str1'', ''str2'', ...):: 1241 join strings, whith ''sep'' as separator [''since 6737''] 1241 join strings, whith ''sep'' as separator [''since r6737''] 1242 1242 join_list(''sep'', ''list_name''):: 1243 joins the elements of the list ''list_name'' to one string separated by the separator ''sep'' [''since 8775''] 1243 joins the elements of the list ''list_name'' to one string separated by the separator ''sep'' [''since r8775''] 1244 1244 upper(''str''):: 1245 converts string to upper case [''since 11756''] 1245 converts string to upper case [''since r11756''] 1246 1246 lower(''str''):: 1247 converts string to lower case [''since 11756''] 1247 converts string to lower case [''since r11756''] 1248 1248 trim(''str''):: 1249 remove leading and trailing whitespace from string [''since 11756''] 1249 remove leading and trailing whitespace from string [''since r11756''] 1250 1250 trim_list(''list_name''):: 1251 remove leading and trailing whitespace from a list of strings, will remove entries that are empty afterwards [''since 15591''] 1251 remove leading and trailing whitespace from a list of strings, will remove entries that are empty afterwards [''since r15591''] 1252 1252 JOSM_search("..."):: 1253 1253 true, if JOSM search applies to the object 1254 1254 tr(str, arg0, arg1, ...):: 1255 translate from English to the current language (only for strings in the JOSM user interface) [''since 6506''] 1255 translate from English to the current language (only for strings in the JOSM user interface) [''since r6506''] 1256 1256 regexp_test(regexp, string):: 1257 test if ''string'' matches pattern ''regexp'' [''since 5699''] 1257 test if ''string'' matches pattern ''regexp'' [''since r5699''] 1258 1258 regexp_test(regexp, string, flags):: 1259 test if ''string'' matches pattern ''regexp''; flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since 5699''] 1259 test if ''string'' matches pattern ''regexp''; flags is a string that may contain "i" (case insensitive), "m" (multiline) and "s" ("dot all") [''since r5699''] 1260 1260 regexp_match(regexp, string):: 1261 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''] 1261 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''] 1262 1262 regexp_match(regexp, string, flags):: 1263 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''] 1263 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''] 1264 1264 substring(str, idx):: 1265 return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since 6534''] 1265 return the substring of ''str'', starting at index ''idx'' (0-indexed) [''since r6534''] 1266 1266 substring(str, start, end):: 1267 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since 6534''] 1267 return the substring of ''str'', starting at index ''start'' (inclusive) up to ''end'' (exclusive) (0-indexed) [''since r6534''] 1268 1268 replace(string, old, new):: 1269 1269 Replaces any occurrence of the substring ''old'' within the string ''string'' with the text ''new'' 1270 1270 osm_id():: 1271 returns the OSM id of the current object [''since 5699''] 1271 returns the OSM id of the current object [''since r5699''] 1272 1272 osm_user_name():: 1273 returns the OSM user name who last touched the current object [''since 15246''] 1273 returns the OSM user name who last touched the current object [''since r15246''] 1274 1274 osm_user_id():: 1275 returns the OSM user id who last touched the current object [''since 15246''] 1275 returns the OSM user id who last touched the current object [''since r15246''] 1276 1276 osm_version():: 1277 returns the OSM version number of the current object [''since 15246''] 1277 returns the OSM version number of the current object [''since r15246''] 1278 1278 osm_changeset_id():: 1279 returns the id of the changeset the current object was last uploaded to [''since 15246''] 1279 returns the id of the changeset the current object was last uploaded to [''since r15246''] 1280 1280 osm_timestamp():: 1281 returns the time of last modification to the current object, as timestamp [''since 15246''] 1281 returns the time of last modification to the current object, as timestamp [''since r15246''] 1282 1282 parent_osm_id():: 1283 returns the OSM id of the object's parent (matched by child selector) [''since 13094''] 1283 returns the OSM id of the object's parent (matched by child selector) [''since r13094''] 1284 1284 URL_encode(str):: 1285 [https://en.wikipedia.org/wiki/Percent-encoding percent-encode] a string. May be useful for data URLs [''since 6805''] 1285 [https://en.wikipedia.org/wiki/Percent-encoding percent-encode] a string. May be useful for data URLs [''since r6805''] 1286 1286 URL_decode(str):: 1287 [https://en.wikipedia.org/wiki/Percent-encoding percent-decode] a string. [''since 11756''] 1287 [https://en.wikipedia.org/wiki/Percent-encoding percent-decode] a string. [''since r11756''] 1288 1288 XML_encode(str):: 1289 escape special characters in xml. E.g. {{{<}}} becomes {{{<}}}, other special characters: {{{>}}}, {{{"}}}, {{{'}}}, {{{&}}}, {{{\n}}}, {{{\t}}} and {{{\r}}} [''since 6809''] 1289 escape special characters in xml. E.g. {{{<}}} becomes {{{<}}}, other special characters: {{{>}}}, {{{"}}}, {{{'}}}, {{{&}}}, {{{\n}}}, {{{\t}}} and {{{\r}}} [''since r6809''] 1290 1290 CRC32_checksum(''str''):: 1291 calculate the CRC32 checksum of a string (result is an integer from 0 to 2^32^-1) [''since 6908''] 1291 calculate the CRC32 checksum of a string (result is an integer from 0 to 2^32^-1) [''since r6908''] 1292 1292 is_right_hand_traffic():: 1293 Check if there is left-hand or right-hand traffic at the current location. [''since 7193''] 1293 Check if there is left-hand or right-hand traffic at the current location. [''since r7193''] 1294 1294 number_of_tags():: 1295 returns the number of tags for the current OSM object [''since 7237''] 1295 returns the number of tags for the current OSM object [''since r7237''] 1296 1296 print(o):: 1297 prints a string representation of `o` to the command line (for debugging) [''since 7237''] 1297 prints a string representation of `o` to the command line (for debugging) [''since r7237''] 1298 1298 println(o):: 1299 prints a string representation of `o` to the command line, followed by a new line (for debugging) [''since 7237''] 1299 prints a string representation of `o` to the command line, followed by a new line (for debugging) [''since r7237''] 1300 1300 JOSM_pref(''key'', ''default''):: 1301 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. Furthermore, in version r16590, it returns strings that can be used to set properties that are used to set colors. So `* { set_color: JOSM_pref("pref", #000000); } *{color: prop("set_color"); }` works now.] 1301 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 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, it returns strings that can be used to set properties that are used to set colors. So `* { set_color: JOSM_pref("pref", #000000); } *{color: prop("set_color"); }` works now.] 1302 1302 setting():: 1303 to use a [wikitr:/Help/Styles/MapCSSImplementation#Stylesettings style setting] [''since 7450''] 1303 to use a [wikitr:/Help/Styles/MapCSSImplementation#Stylesettings style setting] [''since r7450''] 1304 1304 degree_to_radians():: 1305 returns a in degree given direction in radians [''since 8260''] 1305 returns a in degree given direction in radians [''since r8260''] 1306 1306 cardinal_to_radians():: 1307 returns a cardinal direction in radians [''since 8260''] 1307 returns a cardinal direction in radians [''since r8260''] 1308 1308 waylength():: 1309 returns the length of the way in metres [''since 8253''] 1309 returns the length of the way in metres [''since r8253''] 1310 1310 areasize():: 1311 returns the area of a closed way in square meters [''since 8253''] 1311 returns the area of a closed way in square meters [''since r8253''] 1312 1312 at(lat,lon):: 1313 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 12514''] 1313 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''] 1314 1314 is_similar(''str1'', ''str2''):: 1315 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 14371''] 1315 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''] 1316 1316 gpx_distance():: 1317 returns the lowest distance between the OSM object and a GPX point [''since 14802''] 1317 returns the lowest distance between the OSM object and a GPX point [''since r14802''] 1318 1318 count_roles():: 1319 returns the number of primitives in a relation with the specified roles [''since 15275''] 1319 returns the number of primitives in a relation with the specified roles [''since r15275''] 1320 1320 sort(''str1'', ''str2'', ''str3'', ''...''):: 1321 sorts an array of strings [''since 15279''] 1321 sorts an array of strings [''since r15279''] 1322 1322 sort_list():: 1323 sorts a list of strings [''since 15279''] 1323 sorts a list of strings [''since r15279''] 1324 1324 tag_regex(''regex''):: 1325 returns a list of values that match the regex [''since 15317''] 1325 returns a list of values that match the regex [''since r15317''] 1326 1326 to_boolean(''str''):: 1327 returns the string argument as a boolean [''since 16110''] 1327 returns the string argument as a boolean [''since r16110''] 1328 1328 to_byte(''str''):: 1329 returns the string argument as a byte [''since 16110''] 1329 returns the string argument as a byte [''since r16110''] 1330 1330 to_short(''str''):: 1331 returns the string argument as a short [''since 16110''] 1331 returns the string argument as a short [''since r16110''] 1332 1332 to_int(''str''):: 1333 returns the string argument as a int [''since 16110''] 1333 returns the string argument as a int [''since r16110''] 1334 1334 to_long(''str''):: 1335 returns the string argument as a long [''since 16110''] 1335 returns the string argument as a long [''since r16110''] 1336 1336 to_float(''str''):: 1337 returns the string argument as a float [''since 16110''] 1337 returns the string argument as a float [''since r16110''] 1338 1338 to_double(''str''):: 1339 returns the string argument as a double [''since 16110''] 1339 returns the string argument as a double [''since r16110''] 1340 1340 uniq(''str1'', ''str2'', ''str3'', ''...''):: 1341 returns a list of strings that only have unique values from an array of strings [''since 15323''] 1341 returns a list of strings that only have unique values from an array of strings [''since r15323''] 1342 1342 uniq_list():: 1343 returns a list of strings that only have unique values from a list of strings [''since 15353''] 1343 returns a list of strings that only have unique values from a list of strings [''since r15353''] 1344 1344 1345 1345 === Examples === … … 1442 1442 * seems to have {{{[tunnel=1]}}} instead of {{{[tunnel=yes]}}} (Halcyon) or {{{[tunnel?]}}} (JOSM) 1443 1443 1444 == Media queries [''since 6970''] (deprecated) == 1444 == Media queries [''since r6970''] (deprecated) == 1445 1445 1446 1446 {{{#!td style="background-color: #faa"
