| | 233 | {{{#!th valign=top |
| | 234 | '''Operator''' |
| | 235 | }}} |
| | 236 | {{{#!th valign=top |
| | 237 | '''Description''' |
| | 238 | }}} |
| | 239 | {{{#!th valign=top |
| | 240 | '''Example''' |
| | 241 | }}} |
| | 242 | |------------------------------------------------------------------------------- |
| | 243 | {{{#!td align=center valign=top |
| | 244 | `=` |
| | 245 | }}} |
| | 246 | {{{#!td align=left valign=top |
| | 247 | Exact match of the value. |
| | 248 | }}} |
| | 249 | {{{#!td align=left valign=top |
| | 250 | {{{ |
| | 251 | #!mapcss |
| | 252 | way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ |
| | 253 | node[name="My name"] /* use quotes if key or value includes spaces */ |
| | 254 | node["name:pl"="Królewiec"] /* use quotes if key or value includes special characters like colons or unicode characters */ |
| | 255 | }}} |
| | 256 | }}} |
| | 257 | |------------------------------------------------------------------------------- |
| | 258 | {{{#!td align=center valign=top |
| | 259 | `!=` |
| | 260 | }}} |
| | 261 | {{{#!td align=left valign=top |
| | 262 | Value not equal |
| | 263 | }}} |
| | 264 | {{{#!td align=left valign=top |
| | 265 | {{{ |
| | 266 | #!mapcss |
| | 267 | way[highway!=residential] |
| | 268 | node[name!="My name"] |
| | 269 | node["name:pl"!="Królewiec"] |
| | 270 | }}} |
| | 271 | }}} |
| | 272 | |------------------------------------------------------------------------------- |
| | 273 | {{{#!td align=center valign=top |
| | 274 | `<`, `>`, `<=`, `>=` |
| | 275 | }}} |
| | 276 | {{{#!td align=left valign=top |
| | 277 | Comparison for numeric values. |
| | 278 | |
| | 279 | }}} |
| | 280 | {{{#!td align=left valign=top |
| | 281 | {{{ |
| | 282 | #!mapcss |
| | 283 | node[population >= 50000] /* population greater than or equal to 50000 */ |
| | 284 | node[ele = 3000] /* elevation with exactly 3000 meters */ |
| | 285 | }}} |
| | 286 | }}} |
| | 287 | |------------------------------------------------------------------------------- |
| | 288 | {{{#!td align=center valign=top |
| | 289 | `^=` |
| | 290 | }}} |
| | 291 | {{{#!td align=left valign=top |
| | 292 | Prefix match |
| | 293 | }}} |
| | 294 | {{{#!td align=left valign=top |
| | 295 | {{{ |
| | 296 | #!mapcss |
| | 297 | node[name ^= "myprefix"] /* value starts with 'myprefix' */ |
| | 298 | }}} |
| | 299 | }}} |
| | 300 | |------------------------------------------------------------------------------- |
| | 301 | {{{#!td align=center valign=top |
| | 302 | `$=` |
| | 303 | }}} |
| | 304 | {{{#!td align=left valign=top |
| | 305 | Postfix match |
| | 306 | }}} |
| | 307 | {{{#!td align=left valign=top |
| | 308 | {{{ |
| | 309 | #!mapcss |
| | 310 | node[name $= "mypostfix"] /* value ends with 'mypostfix' */ |
| | 311 | }}} |
| | 312 | }}} |
| | 313 | |----------------------------------------------- |
| | 314 | {{{#!td align=center valign=top |
| | 315 | `*=` |
| | 316 | }}} |
| | 317 | {{{#!td align=left valign=top |
| | 318 | Substring match |
| | 319 | }}} |
| | 320 | {{{#!td align=left valign=top |
| | 321 | {{{ |
| | 322 | #!mapcss |
| | 323 | node[name *= "my substring"] /* value contains the substring 'my substring' */ |
| | 324 | }}} |
| | 325 | }}} |
| | 326 | |------------------------------------------------------------------------------- |
| | 327 | {{{#!td align=center valign=top |
| | 328 | `~=` |
| | 329 | }}} |
| | 330 | {{{#!td align=left valign=top |
| | 331 | List membership |
| | 332 | }}} |
| | 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 |
| | 342 | `=~` |
| | 343 | }}} |
| | 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 |
| | 349 | {{{ |
| | 350 | #!mapcss |
| | 351 | *[name=~/^My_pattern.*/] /* the value of the tag 'name' matches with the regular expression '^My_pattern.*' */ |
| | 352 | /* Note, that reqular expressions have to be enclosed in /.../ */ |
| | 353 | }}} |
| | 354 | Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]). |
| | 355 | {{{ |
| | 356 | #!mapcss |
| | 357 | *[name =~ /^(?i)(parking)$/] /* matches parking, Parking, PARKING, PaRkInG,... */ |
| | 358 | *[name =~ /^(?U)(\p{Lower})+$/] /* name consists of only lower case unicode characters */ |
| | 359 | }}} |
| | 360 | }}} |
| | 361 | |------------------------------------------------------------------------------- |
| | 362 | {{{#!td align=center valign=top |
| | 363 | `!~` (since r6455) |
| | 364 | }}} |
| | 365 | {{{#!td align=left valign=top |
| | 366 | negated [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match |
| | 367 | |
| | 368 | }}} |
| | 369 | {{{#!td align=left valign=top |
| | 370 | {{{ |
| | 371 | #!mapcss |
| | 372 | *[surface!~/paved|unpaved/] |
| | 373 | }}} |
| | 374 | }}} |
| | 375 | |------------------------------------------------------------------------------- |
| | 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 |
| | 380 | element of |
| | 381 | |
| | 382 | Matches 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] { |
| | 388 | throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking"); |
| | 389 | } |
| | 390 | }}} |
| | 391 | Finds areas with `amenity=parking` that contain at least one node or area with `amenity=parking`. Since r15064 this rule produces one warning for each element on the left when there are multiple matches. |
| | 392 | }}} |
| | 393 | |------------------------------------------------------------------------------- |
| | 394 | {{{#!td align=center valign=top |
| | 395 | `⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) |
| | 396 | }}} |
| | 397 | {{{#!td align=left valign=top |
| | 398 | Subset of or Equal To |
| | 399 | |
| | 400 | Synonym 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 |
| | 416 | Superset of or Equal To |
| | 417 | |
| | 418 | Matches 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 |
| | 423 | area[amenity=parking] ⊇ *[amenity=parking] |
| | 424 | }}} |
| | 425 | finds nodes or areas with `amenity=parking` inside areas with `amenity=parking`. Slower than `⊆` and thus not useful in validator rules, but can be useful in the search dialog. |
| | 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 |
| | 432 | Neither a Subset of nor Equal To |
| | 433 | |
| | 434 | Matches 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 | }}} |
| | 441 | finds areas amenity=parking that have lit=yes but don't contain a lamp. Always add `:closed2` to avoid false positives as unclosed areas never contain something. |
| | 442 | }}} |
| | 443 | |------------------------------------------------------------------------------- |
| | 444 | {{{#!td align=center valign=top |
| | 445 | `⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) |
| | 446 | }}} |
| | 447 | {{{#!td align=left valign=top |
| | 448 | Neither a Superset of nor Equal To |
| | 449 | |
| | 450 | Matches 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 |
| | 455 | area[landuse=residential] ⊉ *[building] |
| | 456 | }}} |
| | 457 | finds buildings which are not inside any landuse=residential area. Note that this operator is likely to produce false positives when you have `landuse=residential`areas which don't match `:closed2`. |
| | 458 | }}} |
| | 459 | |------------------------------------------------------------------------------- |
| | 460 | {{{#!td align=center valign=top |
| | 461 | `⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) |
| | 462 | }}} |
| | 463 | {{{#!td align=left valign=top |
| | 464 | crossing |
| | 465 | }}} |
| | 466 | {{{#!td align=left valign=top |
| | 467 | {{{ |
| | 468 | #!mapcss |
| | 469 | area:closed:areaStyle ⧉ area:closed:areaStyle { |
| | 470 | throwOther: tr("Overlapping Areas"); |
| | 471 | } |
| | 472 | }}} |
| | 473 | takes `layer` tag into account if set (since r12986) |
| | 474 | }}} |
| | 475 | |
| | 476 | 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]` 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`. |
| | 477 | |
| | 478 | In addition, you can test whether a tag is present or not: |
| | 479 | |
| | 480 | {{{#!th valign=top |
| | 481 | '''Condition''' |
| | 482 | }}} |
| | 483 | {{{#!th valign=top |
| | 484 | '''Example''' |
| | 485 | }}} |
| | 486 | |------------------------------------------------------------------------------- |
| | 487 | {{{#!td align=left valign=top |
| | 488 | Presence of tag |
| | 489 | }}} |
| | 490 | {{{#!td align=left valign=top |
| | 491 | {{{ |
| | 492 | #!mapcss |
| | 493 | way[highway] /* matches any way with a tag 'highway' (is case sensitive) */ |
| | 494 | way["name:fr"] /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */ |
| | 495 | }}} |
| | 496 | }}} |
| | 497 | |------------------------------------------------------------------------------- |
| | 498 | {{{#!td align=left valign=top |
| | 499 | Absence of tag |
| | 500 | }}} |
| | 501 | {{{#!td align=left valign=top |
| | 502 | {{{ |
| | 503 | #!mapcss |
| | 504 | way[!highway] /* matches any way which does not have a tag 'highway' (is case sensitive) */ |
| | 505 | way[!"name:fr"] /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */ |
| | 506 | }}} |
| | 507 | }}} |
| | 508 | |------------------------------------------------------------------------------- |
| | 509 | {{{#!td align=left valign=top |
| | 510 | Presence of tag by [https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html#sum Regular expression] match (since r6547) |
| | 511 | }}} |
| | 512 | {{{#!td align=left valign=top |
| | 513 | {{{ |
| | 514 | #!mapcss |
| | 515 | way[/^addr:/] /* matches any `addr:*` key */ |
| | 516 | }}} |
| | 517 | }}} |
| | 518 | |------------------------------------------------------------------------------- |
| | 519 | {{{#!td align=left valign=top |
| | 520 | Absence of tag by Regular expression match |
| | 521 | }}} |
| | 522 | {{{#!td align=left valign=top |
| | 523 | {{{ |
| | 524 | #!mapcss |
| | 525 | way[!/^addr:/] /* matches any way which does not have a tag 'addr:*' */ |
| | 526 | }}} |
| | 527 | }}} |
| | 528 | |
| | 529 | You can test whether the value of a tag is logical truth value. The value is evaluated to true, if it is either |
| | 530 | "yes", "true", or "1". All other values are evaluated to false. |
| | 531 | |
| | 532 | {{{#!th valign=top |
| | 533 | '''Condition''' |
| | 534 | }}} |
| | 535 | {{{#!th valign=top |
| | 536 | '''Example''' |
| | 537 | }}} |
| | 538 | |------------------------------------------------------------------------------- |
| | 539 | {{{#!td align=left valign=top |
| | 540 | Testing for truth value |
| | 541 | }}} |
| | 542 | {{{#!td align=left valign=top |
| | 543 | {{{ |
| | 544 | #!mapcss |
| | 545 | way[oneway?] /* matches any way with a truth value in the tag 'oneway' */ |
| | 546 | }}} |
| | 547 | }}} |
| | 548 | |------------------------------------------------------------------------------- |
| | 549 | {{{#!td align=left valign=top |
| | 550 | Testing for false value (since r6513) |
| | 551 | }}} |
| | 552 | {{{#!td align=left valign=top |
| | 553 | {{{ |
| | 554 | #!mapcss |
| | 555 | way[oneway?!] /* matches any way with a false value in the tag 'oneway' */ |
| | 556 | }}} |
| | 557 | }}} |
| | 558 | |
| | 559 | === Territory selector === #Territoryselector |
| | 560 | You 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 … */ |
| | 565 | node[inside("FR")] /* … inside of France (includes the overseas territories) */ |
| | 566 | node[inside("FX")] /* … inside of Metropolitan France (i.e. only the |
| | 567 | mainland part with its near islands including Corse) */ |
| | 568 | node[inside("EU")] /* … inside of the European Union */ |
| | 569 | node[inside("FR,DE")] /* … inside of France __OR__ inside of Germany */ |
| | 570 | node[inside("US-FL")] /* … inside of the US state Florida */ |
| | 571 | |
| | 572 | node[outside("FR")] /* … outside of France */ |
| | 573 | node[outside("FR,DE")] /* … outside of France __AND__ outside of Germany */ |
| | 574 | node[inside("US")][outside("US-FL")] /* … inside of the USA except the state Florida */ |
| | 575 | }}} |
| | 576 | |
| | 577 | === Link selector ===#LinkSelector |
| | 578 | In a child selector, you can formulate conditions on the link between a parent and a child object. |
| | 579 | |
| | 580 | If the parent is a relation, you can formulate conditions for the ''role'' a member objects has in this relation. |
| | 581 | {{{ |
| | 582 | #!mapcss |
| | 583 | relation[type=route] >[role="link"] way { /* matches any way which is a member of route relation with role 'link' */ |
| | 584 | color: blue; |
| | 585 | } |
| | 586 | }}} |
| | 587 | |
| 247 | | Exact match of the value. |
| 248 | | }}} |
| 249 | | {{{#!td align=left valign=top |
| 250 | | {{{ |
| 251 | | #!mapcss |
| 252 | | way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ |
| 253 | | node[name="My name"] /* use quotes if key or value includes spaces */ |
| 254 | | node["name:ru"="Калининград"] /* use quotes if key or value includes special characters like colons or unicode characters */ |
| 255 | | }}} |
| 256 | | }}} |
| 257 | | |------------------------------------------------------------------------------- |
| 258 | | {{{#!td align=center valign=top |
| 259 | | `!=` |
| 260 | | }}} |
| 261 | | {{{#!td align=left valign=top |
| 262 | | Value not equal |
| 263 | | }}} |
| 264 | | {{{#!td align=left valign=top |
| 265 | | {{{ |
| 266 | | #!mapcss |
| 267 | | way[highway!=residential] |
| 268 | | node[name!="My name"] |
| 269 | | node["name:ru"!="Калининград"] |
| 270 | | }}} |
| 271 | | }}} |
| 272 | | |------------------------------------------------------------------------------- |
| 273 | | {{{#!td align=center valign=top |
| 274 | | `<`, `>`, `<=`, `>=` |
| 275 | | }}} |
| 276 | | {{{#!td align=left valign=top |
| 277 | | Comparision for numeric values. |
| 278 | | |
| 279 | | }}} |
| 280 | | {{{#!td align=left valign=top |
| 281 | | {{{ |
| 282 | | #!mapcss |
| 283 | | node[population >= 50000] /* population greater than or equal to 50000 */ |
| 284 | | node[ele = 3000] /* elevation with exactly 3000 meters */ |
| 285 | | }}} |
| 286 | | }}} |
| 287 | | |------------------------------------------------------------------------------- |
| 288 | | {{{#!td align=center valign=top |
| 289 | | {{{^=}}} |
| 290 | | }}} |
| 291 | | {{{#!td align=left valign=top |
| 292 | | Prefix match |
| 293 | | }}} |
| 294 | | {{{#!td align=left valign=top |
| 295 | | {{{ |
| 296 | | #!mapcss |
| 297 | | node[name ^= "myprefix"] /* value starts with 'myprefix' */ |
| 298 | | }}} |
| 299 | | }}} |
| 300 | | |------------------------------------------------------------------------------- |
| 301 | | {{{#!td align=center valign=top |
| 302 | | `$=` |
| 303 | | }}} |
| 304 | | {{{#!td align=left valign=top |
| 305 | | Postfix match |
| 306 | | }}} |
| 307 | | {{{#!td align=left valign=top |
| 308 | | {{{ |
| 309 | | #!mapcss |
| 310 | | node[name $= "mypostfix"] /* value ends with 'mypostfix' */ |
| 311 | | }}} |
| 312 | | }}} |
| 313 | | |----------------------------------------------- |
| 314 | | {{{#!td align=center valign=top |
| 315 | | `*=` |
| 316 | | }}} |
| 317 | | {{{#!td align=left valign=top |
| 318 | | Substring match |
| 319 | | }}} |
| 320 | | {{{#!td align=left valign=top |
| 321 | | {{{ |
| 322 | | #!mapcss |
| 323 | | node[name *= "my substring"] /* value contains the substring 'my substring' */ |
| 324 | | }}} |
| 325 | | }}} |
| 326 | | |------------------------------------------------------------------------------- |
| 327 | | {{{#!td align=center valign=top |
| 328 | | `~=` |
| 329 | | }}} |
| 330 | | {{{#!td align=left valign=top |
| 331 | | List membership |
| 332 | | }}} |
| 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 |
| 342 | | `=~` |
| 343 | | }}} |
| 344 | | {{{#!td align=left valign=top |
| 345 | | [https://download.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match |
| 346 | | |
| 347 | | }}} |
| 348 | | {{{#!td align=left valign=top |
| 349 | | {{{ |
| 350 | | #!mapcss |
| 351 | | *[name=~/^My_pattern.*/] /* the value of the tag 'name' matches with the regular expression '^My_pattern.*' */ |
| 352 | | /* Note, that reqular expressions have to be enclosed in /.../ */ |
| 353 | | }}} |
| 354 | | Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/javase/7/docs/api/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 |
| 363 | | `!~` (since r6455) |
| 364 | | }}} |
| 365 | | {{{#!td align=left valign=top |
| 366 | | negated [https://download.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match |
| 367 | | |
| 368 | | }}} |
| 369 | | {{{#!td align=left valign=top |
| 370 | | {{{ |
| 371 | | #!mapcss |
| 372 | | *[surface!~/paved|unpaved/] |
| 373 | | }}} |
| 374 | | }}} |
| 375 | | |------------------------------------------------------------------------------- |
| 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 |
| 380 | | element of |
| 381 | | |
| 382 | | Matches when an object matches the right selector(s) contains at least one element which match the left selector(s). |
| 383 | | |
| 384 | | }}} |
| 385 | | {{{#!td align=left valign=top |
| 386 | | {{{ |
| 387 | | #!mapcss |
| 388 | | *[amenity=parking] ∈ area[amenity=parking] { |
| 389 | | throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking"); |
| 390 | | } |
| 391 | | }}} |
| 392 | | Finds areas with `amenity=parking` that contain at least one node or area with `amenity=parking`. |
| 393 | | Since r15064 this rule produces one warning for each element on the left when there are multiple matches. |
| 394 | | }}} |
| 395 | | |------------------------------------------------------------------------------- |
| 396 | | {{{#!td align=center valign=top |
| 397 | | `⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) |
| 398 | | }}} |
| 399 | | {{{#!td align=left valign=top |
| 400 | | Subset of or Equal To |
| 401 | | |
| 402 | | Synonym for `∈`. |
| 403 | | }}} |
| 404 | | {{{#!td align=left valign=top |
| 405 | | {{{ |
| 406 | | #!mapcss |
| 407 | | *[amenity=parking] ⊆ area[amenity=parking] { |
| 408 | | throwWarning: tr("{0} inside {1}", "amenity=parking", "amenity=parking"); |
| 409 | | } |
| 410 | | }}} |
| 411 | | |
| 412 | | }}} |
| 413 | | |------------------------------------------------------------------------------- |
| 414 | | {{{#!td align=center valign=top |
| 415 | | `⊇` ([https://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102) |
| 416 | | }}} |
| 417 | | {{{#!td align=left valign=top |
| 418 | | Superset of or Equal To |
| 419 | | |
| 420 | | Matches when an object matches the right selector(s) and is contained in one or more elements which match the left selectors. |
| 421 | | |
| 422 | | }}} |
| 423 | | {{{#!td align=left valign=top |
| 424 | | {{{ |
| 425 | | #!mapcss |
| 426 | | area[amenity=parking] ⊇ *amenity=parking] |
| 427 | | }}} |
| 428 | | finds nodes or areas with `amenity=parking` inside areas with `amenity=parking`. Slower than `⊆` and thus not useful in validator rules, but can be useful in the search dialog. |
| 429 | | |
| 430 | | }}} |
| 431 | | |------------------------------------------------------------------------------- |
| 432 | | {{{#!td align=center valign=top |
| 433 | | `⊈` ([https://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102) |
| 434 | | }}} |
| 435 | | {{{#!td align=left valign=top |
| 436 | | Neither a Subset of nor Equal To |
| 437 | | |
| 438 | | Matches when an object matches the right selector(s) and does not contain any element which matches the left selectors. |
| 439 | | |
| 440 | | }}} |
| 441 | | {{{#!td align=left valign=top |
| 442 | | {{{ |
| 443 | | #!mapcss |
| 444 | | *[highway=street_lamp] ⊈ area:closed2[amenity=parking][lit=yes] |
| 445 | | }}} |
| 446 | | finds areas amenity=parking that have lit=yes but don't contain a lamp. |
| 447 | | Always add `:closed2` to avoid false positives as unclosed areas never contain something. |
| 448 | | }}} |
| 449 | | |------------------------------------------------------------------------------- |
| 450 | | {{{#!td align=center valign=top |
| 451 | | `⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) |
| 452 | | }}} |
| 453 | | {{{#!td align=left valign=top |
| 454 | | Neither a Superset of nor Equal To |
| 455 | | |
| 456 | | Matches when an object matches the right selector(s) and is not contained in any area which matches the left selectors. |
| 457 | | |
| 458 | | }}} |
| 459 | | {{{#!td align=left valign=top |
| 460 | | {{{ |
| 461 | | #!mapcss |
| 462 | | area[landuse=residential] ⊉ *[building] |
| 463 | | }}} |
| 464 | | finds buildings which are not inside any landuse=residential area. Note that this operator is likely to produce false positives |
| 465 | | when you have `landuse=residential`areas which don't match `:closed2`. |
| 466 | | }}} |
| 467 | | |------------------------------------------------------------------------------- |
| 468 | | {{{#!td align=center valign=top |
| 469 | | `⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) |
| 470 | | }}} |
| 471 | | {{{#!td align=left valign=top |
| 472 | | crossing |
| 473 | | |
| 474 | | }}} |
| 475 | | {{{#!td align=left valign=top |
| 476 | | {{{ |
| 477 | | #!mapcss |
| 478 | | area:closed:areaStyle ⧉ area:closed:areaStyle { |
| 479 | | throwOther: tr("Overlapping Areas"); |
| 480 | | } |
| 481 | | }}} |
| 482 | | takes `layer` tag into account if set (since r12986) |
| 483 | | }}} |
| 484 | | |
| 485 | | 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]` 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`. |
| 486 | | |
| 487 | | In addition, you can test whether a tag is present or not: |
| 488 | | |
| 489 | | {{{#!th valign=top |
| 490 | | '''Condition''' |
| 491 | | }}} |
| 492 | | {{{#!th valign=top |
| 493 | | '''Example''' |
| 494 | | }}} |
| 495 | | |------------------------------------------------------------------------------- |
| 496 | | {{{#!td align=left valign=top |
| 497 | | Presence of tag |
| 498 | | }}} |
| 499 | | {{{#!td align=left valign=top |
| 500 | | {{{ |
| 501 | | #!mapcss |
| 502 | | way[highway] /* matches any way with a tag 'highway' (is case sensitive) */ |
| 503 | | way["name:fr"] /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */ |
| 504 | | }}} |
| 505 | | }}} |
| 506 | | |------------------------------------------------------------------------------- |
| 507 | | {{{#!td align=left valign=top |
| 508 | | Absence of tag |
| 509 | | }}} |
| 510 | | {{{#!td align=left valign=top |
| 511 | | {{{ |
| 512 | | #!mapcss |
| 513 | | way[!highway] /* matches any way which does not have a tag 'highway' (is case sensitive) */ |
| 514 | | way[!"name:fr"] /* use quotes if the tag name includes special caracters (white space, colons, unicode characters, etc.) */ |
| 515 | | }}} |
| 516 | | }}} |
| 517 | | |------------------------------------------------------------------------------- |
| 518 | | {{{#!td align=left valign=top |
| 519 | | Presence of tag by [https://download.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match (since r6547) |
| 520 | | }}} |
| 521 | | {{{#!td align=left valign=top |
| 522 | | {{{ |
| 523 | | #!mapcss |
| 524 | | way[/^addr:/] /* matches any `addr:*` key */ |
| 525 | | }}} |
| 526 | | }}} |
| 527 | | |------------------------------------------------------------------------------- |
| 528 | | {{{#!td align=left valign=top |
| 529 | | Absence of tag by Regular expression match |
| 530 | | }}} |
| 531 | | {{{#!td align=left valign=top |
| 532 | | {{{ |
| 533 | | #!mapcss |
| 534 | | way[!/^addr:/] /* matches any way which does not have a tag 'addr:*' */ |
| 535 | | }}} |
| 536 | | }}} |
| 537 | | |
| 538 | | You can test whether the value of a tag is logical truth value. The value is evaluated to true, if it is either |
| 539 | | "yes", "true", or "1". All other values are evaluated to false. |
| 540 | | |
| 541 | | {{{#!th valign=top |
| 542 | | '''Condition''' |
| 543 | | }}} |
| 544 | | {{{#!th valign=top |
| 545 | | '''Example''' |
| 546 | | }}} |
| 547 | | |------------------------------------------------------------------------------- |
| 548 | | {{{#!td align=left valign=top |
| 549 | | Testing for truth value |
| 550 | | }}} |
| 551 | | {{{#!td align=left valign=top |
| 552 | | {{{ |
| 553 | | #!mapcss |
| 554 | | way[oneway?] /* matches any way with a truth value in the tag 'oneway' */ |
| 555 | | }}} |
| 556 | | }}} |
| 557 | | |------------------------------------------------------------------------------- |
| 558 | | {{{#!td align=left valign=top |
| 559 | | Testing for false value (since r6513) |
| 560 | | }}} |
| 561 | | {{{#!td align=left valign=top |
| 562 | | {{{ |
| 563 | | #!mapcss |
| 564 | | way[oneway?!] /* matches any way with a false value in the tag 'oneway' */ |
| 565 | | }}} |
| 566 | | }}} |
| 567 | | |
| 568 | | === Territory selector === |
| 569 | | |
| 570 | | You 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]. See #10387 for main implementation of this feature. |
| 571 | | |
| 572 | | {{{ |
| 573 | | #!mapcss |
| 574 | | node[inside("FR")] /* matches any node located inside of France (this includes all the overseas territories) */ |
| 575 | | node[inside("FX")] /* matches any node located inside of Metropolitan France (i.e. only the mainland part with its near islands including Corse) */ |
| 576 | | node[inside("EU")] /* matches any node located inside of the European Union */ |
| 577 | | node[inside("FR,DE")] /* matches any node located inside of France __OR__ inside of Germany */ |
| 578 | | node[inside("US-FL")] /* matches any node located inside of the US state Florida */ |
| 579 | | |
| 580 | | node[outside("FR")] /* matches any node located outside of France */ |
| 581 | | node[outside("FR,DE")] /* matches any node located outside of France __AND__ outside of Germany */ |
| 582 | | node[inside("US")][outside("US-FL")] /* matches any node located inside of the USA except the state Florida */ |
| 583 | | }}} |
| 584 | | |
| 585 | | === Link selector === |
| 586 | | In a child selector, you can formulate conditions on the link between a parent and a child object. |
| 587 | | |
| 588 | | If the parent is a relation, you can formulate conditions for the ''role'' a member objects has in this relation. |
| 589 | | {{{ |
| 590 | | #!mapcss |
| 591 | | relation[type=route] >[role="link"] way { /* matches any way which is a member of route relation with role 'link' */ |
| 592 | | color: blue; |
| 593 | | } |
| 594 | | }}} |
| 595 | | |
| 596 | | {{{#!th valign=top |
| 597 | | '''Operator''' |
| 598 | | }}} |
| 599 | | {{{#!th valign=top |
| 600 | | '''Description''' |
| 601 | | }}} |
| 602 | | {{{#!th valign=top |
| 603 | | '''Example''' |
| 604 | | }}} |
| 605 | | |------------------------------------------------------------------------------- |
| 606 | | {{{#!td align=center valign=top |
| 607 | | `=` |
| 608 | | }}} |
| 609 | | {{{#!td align=left valign=top |
| 610 | | Exact match of the role name. The name name {{{role}}} is compulsory in this context. |
| | 602 | Exact match of the role name. The name `role` is compulsory in this context. |
| 665 | | ||= Class =||= Description =|| |
| 666 | | || {{{:closed}}} || true for ways where the first node is the same as the last and for any (completely downloaded) multipolygon relation || |
| 667 | | || {{{:closed2}}} || same as above, but this one ignores if a multipolygon is downloaded completely (since r9099) || |
| 668 | | || {{{:completely_downloaded}}} || true for a relation whose members are all downloaded (since r9099) || |
| 669 | | || {{{:new}}} || all new objects || |
| 670 | | || {{{:connection}}} || true for nodes that are used by more than one way || |
| 671 | | || {{{:unconnected}}} || true for nodes that are not used by any way (since r6687) || |
| 672 | | || {{{: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) |
| 673 | | || {{{: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 || |
| 674 | | || {{{:clockwise}}} || Whether the way is closed and oriented clockwise, or non-closed and the 1st, 2nd and last node are in clockwise order. || |
| 675 | | || {{{:anticlockwise}}} || Whether the way is closed and oriented anticlockwise, or non-closed and the 1st, 2nd and last node are in anticlockwise order. || |
| 676 | | || {{{:unclosed_multipolygon}}} || true for fully loaded unclosed multipolygon relations (since r8252) || |
| 677 | | || {{{:open_end}}} || to select end nodes of unclosed multipolygon relations with `relation:unclosed_multipolygon >:open_end node` (since r8252) || |
| 678 | | || {{{:in-downloaded-area}}} || true if an object is within source area and false if in the hatched area (since r8495). || |
| 679 | | || {{{:selected}}} || true if an object is selected in the editor (since r9341). || |
| 680 | | || {{{:modified}}} || changed objects (since r7193). || |
| 681 | | You can also negate pseudo classes. E.g. {{{!:new}}} for all old objects. |
| | 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). || |
| | 664 | You can also negate pseudo classes. E.g. `!:new` for all old objects. |
| 1058 | | || `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`. || - || |
| 1059 | | || `icon-position` || Define the position of the icon for areas. Same as `text-position` (since r11730). || {{{center}}}, {{{inside}}}, {{{line}}} || {{{center}}} || |
| 1060 | | || {{{symbol-shape}}} || Display a symbol at the position of the node || {{{square}}}, {{{circle}}}, {{{triangle}}}, {{{pentagon}}}, {{{hexagon}}}, {{{heptagon}}}, {{{octagon}}}, {{{nonagon}}}, {{{decagon}}} || - || |
| 1061 | | || {{{symbol-size}}} || Size of the symbol || ''Number'', can be relative ("+4") || 10 || |
| 1062 | | || {{{symbol-stroke-width}}} || outline stroke width || ''Width'' || 1.0 if {{{symbol-stroke-color}}} is set || |
| 1063 | | || {{{symbol-stroke-color}}} || line color || ''Color'' || {{{#FFC800}}} if {{{symbol-stroke-width}}} is set || |
| 1064 | | || {{{symbol-stroke-opacity}}} || line opacity || ''Opacity'' || 1.0 || |
| 1065 | | || {{{symbol-fill-color}}} || fill color for the shape || ''Color'' || {{{blue}}}, unless either {{{symbol-stroke-width}}} or {{{symbol-stroke-color}}} is set || |
| 1066 | | || {{{symbol-fill-opacity}}} || fill opacity || ''Opacity'' || 1.0 || |
| 1067 | | || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || |
| 1068 | | || {{{text-anchor-horizontal}}} || horizontal text label placement || {{{left}}}, {{{center}}}, {{{right}}} || {{{right}}} || |
| 1069 | | || {{{text-anchor-vertical}}} || vertical text label placement || {{{above}}}, {{{top}}}, {{{center}}}, {{{bottom}}}, {{{below}}} || {{{bottom}}} || |
| 1070 | | || {{{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.) || - || |
| 1071 | | |
| 1072 | | 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. |
| 1073 | | |
| 1074 | | |
| 1075 | | |
| 1076 | | |
| 1077 | | |
| 1078 | | === 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 | |
| | 1058 | Do not rely on the default values for `symbol-...` properties (except for `opacity`). They are intended for "quick & dirty" style sheets and should be set to an explicit value. |
| | 1059 | |
| | 1060 | === Line styles ===#LineStyles |
| 1080 | | || {{{width}}} || Line width || ''Width'' || - || |
| 1081 | | || {{{color}}} || Line color || ''Color'' || value of {{{fill-color}}} or (if unset) JOSM's default untagged color ({{{#808080}}}) || |
| 1082 | | || {{{opacity}}} || How transparent the line is. || ''Opacity'' || 1.0 || |
| 1083 | | || {{{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 || - || |
| 1084 | | || {{{dashes-offset}}} || shift the dash pattern by a certain amount || ''Number'' (>= 0) || 0 || |
| 1085 | | || {{{dashes-background-color}}} || The color to use in between the dashes (optional) || ''Color'' || - || |
| 1086 | | || {{{dashes-background-opacity}}} || Opacity value for the dashes background || ''Opacity'' || value of {{{opacity}}} || |
| 1087 | | || {{{linecap}}} || Shape at the end of the line (see [https://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty here]) || {{{none}}}, {{{round}}}, {{{square}}} || {{{none}}} || |
| 1088 | | || {{{linejoin}}} || Shape at the line corners || {{{round}}}, {{{miter}}}, {{{bevel}}} || {{{round}}} || |
| 1089 | | || {{{miterlimit}}} || Applies for {{{linejoin: miter}}}. Sets the maximum overshoot when line segments meet at a very small angle || ''Number'' (>= 1.0) || 10.0 || |
| 1090 | | || {{{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 || |
| 1091 | | || {{{text-position}}} || set to {{{line}}}, if text should be drawn along the line || {{{line}}}, {{{center}}} || - || |
| 1092 | | || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || |
| | 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 || |
| 1104 | | || {{{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) || - || |
| 1105 | | || {{{casing-color}}} || Casing color || ''Color'' || value of {{{fill-color}}} or (if unset) JOSM's default untagged color ({{{#808080}}}) || |
| 1106 | | || {{{casing-opacity}}} || How transparent the casing is. || ''Opacity'' || 1.0 || |
| 1107 | | || {{{casing-}}}... || ... || ... || ... || |
| 1108 | | 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. |
| 1109 | | |
| 1110 | | === Area styles === |
| 1111 | | ||= '''Key''' =||= '''Description''' =||= '''Value Format''' =||= '''Default Value''' =|| |
| 1112 | | || {{{fill-color}}} || Color in which to fill the area. Until 11700, the alpha component was set to 50 to create a transparency effect. || ''Color'' || - || |
| 1113 | | || {{{fill-image}}} || Image pattern || ''Image'' || - || |
| 1114 | | || {{{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'' || - || |
| 1115 | | || {{{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'' || - || |
| 1116 | | || {{{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) || |
| 1117 | | || {{{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}}} || - || |
| 1118 | | || {{{text-...}}}, {{{font-...}}} |||||| general text & font properties || |
| 1119 | | Required properties to create an Area style: {{{fill-color}}} or {{{fill-image}}} |
| 1120 | | |
| | 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-`... || ... || ... || ... || |
| | 1090 | Similar to `casing-`, there is also the `left-casing-` and `right-casing-` prefix. It draws additional lines to the left and to the right of the main line. |
| | 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 || |
| | 1101 | Required properties to create an Area style: `fill-color` or `fill-image` |
| 1163 | | || {{{text-color}}} || the text color || ''Color'' || {{{white}}} for lines and nodes, {{{#c0c0c0}}} for areas (JOSM "{{{text}}}" and "{{{areatext}}}" color preferences) || |
| 1164 | | || {{{text-opacity}}} || how transparent the text is || ''Opacity'' || 1.0 || |
| 1165 | | || {{{text-offset-x}}} || shift the text horizontally, (not supported for text along line) || ''Number'' || 0 || |
| 1166 | | || {{{text-offset-y}}} (can also be written as {{{text-offset}}}) || shift the text vertically, positive values shift the text in upwards direction || ''Number'' || 0 || |
| 1167 | | || {{{text-halo-radius}}} || size of text background border (to make text visible on background with a similar color) || ''Number'' || - || |
| 1168 | | || {{{text-halo-color}}} || color of the text halo || ''Color'' || complement of the text color || |
| 1169 | | || {{{text-halo-opacity}}} || transparency for the text halo || ''Opacity'' || 1.0 || |
| 1170 | | || {{{font-family}}} || font family || ''String'' || "Droid Sans"[[br]](JOSM preference "mappaint.font") || |
| 1171 | | || {{{font-size}}} || font size || ''Number'' || 8[[br]](JOSM preference "mappaint.fontsize") || |
| 1172 | | || {{{font-weight}}} || bold or not || {{{bold}}}, {{{normal}}} || {{{normal}}} || |
| 1173 | | || {{{font-style}}} || italic or not || {{{italic}}}, {{{normal}}} || {{{normal}}} || |
| | 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` || |