Changes between Version 204 and Version 205 of Help/Styles/MapCSSImplementation
- Timestamp:
- 2022-03-10T17:39:19+01:00 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Help/Styles/MapCSSImplementation
v204 v205 227 227 Selectors can include a set of conditions. If any of these conditions evaluates to false, the selector doesn't match and the style rule isn't applied. 228 228 229 An '''attribute condition''' specifies a condition on a tag of an OSM object. 229 An '''attribute condition''' specifies a condition on a tag of an OSM object. 230 230 231 231 [=#condition_selector_operators] 232 {{{#!th valign=top 232 {{{#!th valign=top 233 233 '''Operator''' 234 234 }}} … … 240 240 }}} 241 241 |------------------------------------------------------------------------------- 242 {{{#!td align=center 242 {{{#!td align=center valign=top 243 243 `=` 244 244 }}} 245 {{{#!td align=left 245 {{{#!td align=left valign=top 246 246 Exact match of the value. 247 247 }}} 248 {{{#!td align=left 249 {{{ 250 #!mapcss 251 way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ 252 node[name="My name"] /* use quotes if key or value includes spaces */ 248 {{{#!td align=left valign=top 249 {{{ 250 #!mapcss 251 way[highway=residential] /* is case sensitive, i.e. does NOT match e.g. highway=Residential or Highway=residential */ 252 node[name="My name"] /* use quotes if key or value includes spaces */ 253 253 node["name:ru"="Калининград"] /* use quotes if key or value includes special characters like colons or unicode characters */ 254 254 }}} 255 255 }}} 256 256 |------------------------------------------------------------------------------- 257 {{{#!td align=center 257 {{{#!td align=center valign=top 258 258 `!=` 259 259 }}} 260 {{{#!td align=left 261 Value not equal 262 }}} 263 {{{#!td align=left 260 {{{#!td align=left valign=top 261 Value not equal 262 }}} 263 {{{#!td align=left valign=top 264 264 {{{ 265 265 #!mapcss … … 270 270 }}} 271 271 |------------------------------------------------------------------------------- 272 {{{#!td align=center 272 {{{#!td align=center valign=top 273 273 `<`, `>`, `<=`, `>=` 274 274 }}} 275 {{{#!td align=left 276 Comparis ion for numeric values.277 278 }}} 279 {{{#!td align=left 275 {{{#!td align=left valign=top 276 Comparison for numeric values. 277 278 }}} 279 {{{#!td align=left valign=top 280 280 {{{ 281 281 #!mapcss 282 282 node[population >= 50000] /* population greater than or equal to 50000 */ 283 node[ele = 3000] /* elevation with exactly 3000 meters */ 284 }}} 285 }}} 286 |------------------------------------------------------------------------------- 287 {{{#!td align=center 283 node[ele = 3000] /* elevation with exactly 3000 meters */ 284 }}} 285 }}} 286 |------------------------------------------------------------------------------- 287 {{{#!td align=center valign=top 288 288 `^=` 289 289 }}} 290 {{{#!td align=left 290 {{{#!td align=left valign=top 291 291 Prefix match 292 292 }}} 293 {{{#!td align=left 293 {{{#!td align=left valign=top 294 294 {{{ 295 295 #!mapcss … … 298 298 }}} 299 299 |------------------------------------------------------------------------------- 300 {{{#!td align=center 300 {{{#!td align=center valign=top 301 301 `$=` 302 302 }}} 303 {{{#!td align=left 303 {{{#!td align=left valign=top 304 304 Postfix match 305 305 }}} 306 {{{#!td align=left 306 {{{#!td align=left valign=top 307 307 {{{ 308 308 #!mapcss … … 311 311 }}} 312 312 |----------------------------------------------- 313 {{{#!td align=center 313 {{{#!td align=center valign=top 314 314 `*=` 315 315 }}} 316 {{{#!td align=left 316 {{{#!td align=left valign=top 317 317 Substring match 318 318 }}} 319 {{{#!td align=left 319 {{{#!td align=left valign=top 320 320 {{{ 321 321 #!mapcss … … 324 324 }}} 325 325 |------------------------------------------------------------------------------- 326 {{{#!td align=center 326 {{{#!td align=center valign=top 327 327 `~=` 328 328 }}} 329 {{{#!td align=left 329 {{{#!td align=left valign=top 330 330 List membership 331 331 }}} 332 {{{#!td align=left 333 {{{ 334 #!mapcss 335 *[vending~=stamps] /* the tag value for the tag 'vending' consists of a list of ;-separated values 336 /* and one of these values is 'stamps' 337 }}} 338 }}} 339 |------------------------------------------------------------------------------- 340 {{{#!td align=center 332 {{{#!td align=left valign=top 333 {{{ 334 #!mapcss 335 *[vending~=stamps] /* the tag value for the tag 'vending' consists of a list of ;-separated values */ 336 /* and one of these values is 'stamps' */ 337 }}} 338 }}} 339 |------------------------------------------------------------------------------- 340 {{{#!td align=center valign=top 341 341 `=~` 342 342 }}} 343 {{{#!td align=left 343 {{{#!td align=left valign=top 344 344 [https://download.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match 345 345 346 346 }}} 347 {{{#!td align=left 347 {{{#!td align=left valign=top 348 348 {{{ 349 349 #!mapcss 350 350 *[name=~/^My_pattern.*/] /* the value of the tag 'name' matches with the regular expression '^My_pattern.*' */ 351 /* Note, that reqular expressions have to be enclosed in /.../ */ 351 /* Note, that reqular expressions have to be enclosed in /.../ */ 352 352 }}} 353 353 Case-insensitive matching can be enabled via the embedded flag expression `(?i)` (see [https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE Pattern.CASE_INSENSITIVE]). 354 354 {{{ 355 355 #!mapcss 356 *[name =~ /^(?i)(parking)$/] /* matches parking, Parking, PARKING, PaRkInG,... */357 *[name =~ /^(?U)(\p{Lower})+$/] /* name consists of only lower case unicode characters */ 358 }}} 359 }}} 360 |------------------------------------------------------------------------------- 361 {{{#!td align=center 356 *[name =~ /^(?i)(parking)$/] /* matches parking, Parking, PARKING, PaRkInG,... */ 357 *[name =~ /^(?U)(\p{Lower})+$/] /* name consists of only lower case unicode characters */ 358 }}} 359 }}} 360 |------------------------------------------------------------------------------- 361 {{{#!td align=center valign=top 362 362 `!~` (since r6455) 363 363 }}} 364 {{{#!td align=left 364 {{{#!td align=left valign=top 365 365 negated [https://download.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html#sum Regular expression] match 366 366 367 367 }}} 368 {{{#!td align=left 368 {{{#!td align=left valign=top 369 369 {{{ 370 370 #!mapcss … … 373 373 }}} 374 374 |------------------------------------------------------------------------------- 375 {{{#!td align=center 375 {{{#!td align=center valign=top 376 376 `∈` ([https://www.fileformat.info/info/unicode/char/2208/index.htm U+2208], since r6609) 377 377 }}} 378 {{{#!td align=left 378 {{{#!td align=left valign=top 379 379 element of 380 380 381 381 Matches when an object matches the right selector(s) contains at least one element which match the left selector(s). 382 383 }}} 384 {{{#!td align=left valign=top 382 }}} 383 {{{#!td align=left valign=top 385 384 {{{ 386 385 #!mapcss … … 389 388 } 390 389 }}} 391 Finds areas with `amenity=parking` that contain at least one node or area with `amenity=parking`. 392 Since r15064 this rule produces one warning for each element on the left when there are multiple matches. 393 }}} 394 |------------------------------------------------------------------------------- 395 {{{#!td align=center valign=top 390 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. 391 }}} 392 |------------------------------------------------------------------------------- 393 {{{#!td align=center valign=top 396 394 `⊆` ([https://www.fileformat.info/info/unicode/char/2286/index.htm U+2286], since r15102) 397 395 }}} 398 {{{#!td align=left 396 {{{#!td align=left valign=top 399 397 Subset of or Equal To 400 398 401 399 Synonym for `∈`. 402 400 }}} 403 {{{#!td align=left 401 {{{#!td align=left valign=top 404 402 {{{ 405 403 #!mapcss … … 411 409 }}} 412 410 |------------------------------------------------------------------------------- 413 {{{#!td align=center 411 {{{#!td align=center valign=top 414 412 `⊇` ([https://www.fileformat.info/info/unicode/char/2287/index.htm U+2287], since r15102) 415 413 }}} 416 {{{#!td align=left 414 {{{#!td align=left valign=top 417 415 Superset of or Equal To 418 416 419 417 Matches when an object matches the right selector(s) and is contained in one or more elements which match the left selectors. 420 421 }}} 422 {{{#!td align=left valign=top 423 {{{ 424 #!mapcss 425 area[amenity=parking] ⊇ *[amenity=parking] 418 }}} 419 {{{#!td align=left valign=top 420 {{{ 421 #!mapcss 422 area[amenity=parking] ⊇ *[amenity=parking] 426 423 }}} 427 424 finds nodes or areas with `amenity=parking` inside areas with `amenity=parking`. Slower than `⊆` and thus not useful in validator rules, but can be useful in the search dialog. 428 429 }}} 430 |------------------------------------------------------------------------------- 431 {{{#!td align=center valign=top 425 }}} 426 |------------------------------------------------------------------------------- 427 {{{#!td align=center valign=top 432 428 `⊈` ([https://www.fileformat.info/info/unicode/char/2288/index.htm U+2288], since r15102) 433 429 }}} 434 {{{#!td align=left 430 {{{#!td align=left valign=top 435 431 Neither a Subset of nor Equal To 436 432 437 433 Matches when an object matches the right selector(s) and does not contain any element which matches the left selectors. 438 439 }}} 440 {{{#!td align=left valign=top 434 }}} 435 {{{#!td align=left valign=top 441 436 {{{ 442 437 #!mapcss 443 438 *[highway=street_lamp] ⊈ area:closed2[amenity=parking][lit=yes] 444 439 }}} 445 finds areas amenity=parking that have lit=yes but don't contain a lamp. 446 Always add `:closed2` to avoid false positives as unclosed areas never contain something. 447 }}} 448 |------------------------------------------------------------------------------- 449 {{{#!td align=center valign=top 440 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. 441 }}} 442 |------------------------------------------------------------------------------- 443 {{{#!td align=center valign=top 450 444 `⊉` ([https://www.fileformat.info/info/unicode/char/2289/index.htm U+2289], since r15102) 451 445 }}} 452 {{{#!td align=left 446 {{{#!td align=left valign=top 453 447 Neither a Superset of nor Equal To 454 448 455 449 Matches when an object matches the right selector(s) and is not contained in any area which matches the left selectors. 456 457 }}} 458 {{{#!td align=left valign=top 450 }}} 451 {{{#!td align=left valign=top 459 452 {{{ 460 453 #!mapcss 461 454 area[landuse=residential] ⊉ *[building] 462 455 }}} 463 finds buildings which are not inside any landuse=residential area. Note that this operator is likely to produce false positives 464 when you have `landuse=residential`areas which don't match `:closed2`. 465 }}} 466 |------------------------------------------------------------------------------- 467 {{{#!td align=center valign=top 456 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`. 457 }}} 458 |------------------------------------------------------------------------------- 459 {{{#!td align=center valign=top 468 460 `⧉` ([https://www.fileformat.info/info/unicode/char/29c9/index.htm U+29C9], since r6613) 469 461 }}} 470 {{{#!td align=left 462 {{{#!td align=left valign=top 471 463 crossing 472 473 }}} 474 {{{#!td align=left valign=top 464 }}} 465 {{{#!td align=left valign=top 475 466 {{{ 476 467 #!mapcss … … 551 542 {{{ 552 543 #!mapcss 553 way[oneway?] /* matches any way with a truth value in the tag 'oneway' 544 way[oneway?] /* matches any way with a truth value in the tag 'oneway' */ 554 545 }}} 555 546 }}} … … 561 552 {{{ 562 553 #!mapcss 563 way[oneway?!] /* matches any way with a false value in the tag 'oneway' 554 way[oneway?!] /* matches any way with a false value in the tag 'oneway' */ 564 555 }}} 565 556 }}}