Changes between Version 7 and Version 8 of NameTemplate


Ignore:
Timestamp:
2012-04-05T13:05:50+02:00 (14 years ago)
Author:
simon04
Comment:

formatting

Legend:

Unmodified
Added
Removed
Modified
  • NameTemplate

    v7 v8  
    11[[TranslatedPages]]
    2 Name templates can be used to define custom formatting for gpx waypoints or osm primitives (for example in the Relations or the Selection lists).
     2**Name templates can be used to define custom formatting for OSM primitives or GPX waypoints** (for example in the Relations or the Selection lists).
    33
    44= Where to define =
    55
    6 Create a text file as described below. Then refer to it from Tagging Presets (F12, Map Settings (3rd item), 3rd tab)
     6Create a text file as described below. Then refer to it from [[TaggingPresets]].
    77
    88= Configuration file =
     
    2323
    2424= Syntax =
    25 * {var} - use value of variable var
    26 * ?{condition1 'value1' | condition2 'value2 | 'value3'} - use value1 if condition1 is satisfied, value3 is no condition is satisfied. Condition can be either explicit -  the same expression as in search or filters is used - or implicit; the value is used when all variables used inside exist
    27 * !{search_expression 'template'} - search_expression is evaluated and first matching primitive is used as context for template. Useful for example to get tags of parent relation.
     25* `{var}` - use value of variable var
     26* `?{condition1 'value1' | condition2 'value2 | 'value3'}` - use value1 if condition1 is satisfied, value3 is no condition is satisfied. Condition can be either explicit -  the same expression as in search or filters is used - or implicit; the value is used when all variables used inside exist
     27* `!{search_expression 'template'}` - search_expression is evaluated and first matching primitive is used as context for template. Useful for example to get tags of parent relation.
    2828
    2929= Samples =
    3030||= Template =||= Tags =||= Result =||
    31 || House number {addr:housenumber} || addr:housenumber=10 || House number 10
    32 || ?{ 'House number {addr:housenumber} at {addr:street}' | 'House number {addr:housenumber}'  } || addr:housenumber=10 || House number 10
     31|| `House number {addr:housenumber}` || `addr:housenumber=10` || House number 10
     32|| `?{ 'House number {addr:housenumber} at {addr:street}' | 'House number {addr:housenumber}'  }` || `addr:housenumber=10` || House number 10
    3333|| || addr:housenumber=10, addr:street=Abbey road || House number 10 at Abbey road
    34 || ?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | admin_level = 6 'NUTS 3' |  'Admin level {admin_level}'} ||  admin_level=4 || NUTS 2
    35 || || admin_level=5 || Admin level 5
    36 || {{{ {admin_level} - {name} !{parent() type=boundary '?{'(part of {admin_level} - {name})' | ''}'}  }}} || admin_level=6 name=Vysocina, member of relation admin_level=4 name=Jihovychod || 6 - Vysocina (part of Jihovychod)
    37 || ||  admin_level=2 name=Czech republic (no parents) || 2 - Czech republic
     34|| `?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | admin_level = 6 'NUTS 3' |  'Admin level {admin_level}'}` ||  `admin_level=4` || NUTS 2
     35|| || `admin_level=5` || Admin level 5
     36|| `{admin_level} - {name} !{parent() type=boundary '?{'(part of {admin_level} - {name})' | ''}'}` || `admin_level=6 name=Vysocina`, member of relation `admin_level=4 name=Jihovychod` || 6 - Vysocina (part of Jihovychod)
     37|| ||  `admin_level=2 name=Czech republic` (no parents) || 2 - Czech republic
    3838
    3939= Available values =
    40 For formatting of OSM primitives , the value of any tag can be used. You can use {special:everything} to see what values are available for your gpx waypoints.
     40For formatting of OSM primitives , the value of any tag can be used. You can use `{special:everything}` to see what values are available for your gpx waypoints.
    4141
    4242Some additional variables are available  via the special prefix:
    43 - {special:everything} prints all available values, available for formatting of both primitives and waypoints.
    44 - {special:id} prints the ID of an osm primitive
    45 - {special:localName} prints the localized name, that is the value of name:lang for your language if it is available or the value of the name tag if it doesn't.
     43- `{special:everything}` prints all available values, available for formatting of both primitives and waypoints.
     44- `{special:id}` prints the ID of an osm primitive
     45- `{special:localName}` prints the localized name, that is the value of name:lang for your language if it is available or the value of the name tag if it doesn't.