Changes between Version 152 and Version 153 of TaggingPresets


Ignore:
Timestamp:
2020-03-19T17:46:20+01:00 (6 years ago)
Author:
skyper
Comment:

use same format on whole page; wikitr:

Legend:

Unmodified
Added
Removed
Modified
  • TaggingPresets

    v152 v153  
    1 ''If you want to learn installation steps for presets, see [Help/Preferences/Map#TaggingPresets "Tagging Presets" tab in Preferences > Map Settings]''[[br]]
    2 ''If you want to use presets or need complete reference of presets see [wiki:Presets Presets]''[[br]]
     1''If you want to learn installation steps for presets, see [wikitr:/Help/Preferences/Map#TaggingPresets "Tagging Presets" tab in Preferences > Map Settings]''\\
     2''If you want to use presets or need complete reference of presets see [wikitr:/Presets Presets]''\\
     3
    34[[TranslatedPages]]
    45[[PageOutline(2-10,Table of Contents)]]
     6
    57= Tagging Presets =
    68JOSM supports distributed tagging presets. This is a XML config file that describes a GUI for entering tags (or properties, annotations, sometimes called map features).
     
    1113The tagging preset description is in a very simple XML format. Details see [#XML below].
    1214
    13 See the **[source:trunk/resources/data/defaultpresets.xml defaultpresets.xml]** for an example covering most of the possibilities listed below.
     15See the **[source:/trunk/resources/data/defaultpresets.xml defaultpresets.xml]** for an example covering most of the possibilities listed below.
    1416
    1517Example:
     
    3537</presets>
    3638}}}
     39\\
    3740
    3841== XML Format description ==#XML
    39 
    40 The full XSD schema is available at the namespace URI (http://josm.openstreetmap.de/tagging-preset-1.0) as well as [source:trunk/resources/data/tagging-preset.xsd the source repository].
     42The full XSD schema is available at the namespace URI (https://josm.openstreetmap.de/tagging-preset-1.0) as well as [source:/trunk/resources/data/tagging-preset.xsd the source repository].
     43
    4144=== Tags ===
    4245==== The document prolog ====
     
    4952  * '''shortdescription''' (i18n) - very short overview description i.e. the "name" of the preset
    5053  * '''link''' (i18n) - web link to further details (optional)
    51   * '''icon''' - informational icon for the whole preset. (This is nedded to display the icon in the table at [[Presets]].)
     54  * '''icon''' - informational icon for the whole preset. (This is nedded to display the icon in the table at [wikitr:/Presets Presets].)
    5255  * '''baselanguage''' - when the base language is not English, specify it here (using non English preset texts prevents automatic translation)
    5356
    5457  (i18n) means the values may also be localized (e.g. de.description).
    55 [[BR]]
     58\\
     59
    5660==== Comments ====
    5761 <!-- this is an example comment -->::
    5862  The document can contain embedded comments.
    59 [[BR]]
     63\\
     64
    6065==== Preset group creation ====
    6166 <group>::
     
    6570 <separator/>::
    6671  Insert a line separator into the menu.
    67 [[BR]]
     72\\
     73
    6874==== Preset window layout ====
    6975 <label>::
     
    7278  Add some space (ie a newline).
    7379 <optional>::
    74   Used to group some optional elements of an item. The `text` attribute is optional. If used without `text` then this is equivalent to <space /><label text="Optional Attributes:"/><space />
     80  Used to group some optional elements of an item. The `text` attribute is optional. If used without `text` then this is equivalent to `<space /><label text="Optional Attributes:"/><space />`
    7581 <item_separator />::
    7682  Add a horizontal separator line between items.
     
    8086  To group checks. The `columns` attribute is required.
    8187 <roles>::
    82   This is required around <role> and adds the heading ("Availible roles role count elements") to the table which is generated by several <role>.
     88  This is required around `<role>` and adds the heading ("Available roles role count elements") to the table which is generated by several `<role>`.
    8389 <role>::
    8490  To specify possible roles of members in relations. The `key` attribute is required, `text`, `requisite`, `count`, `type` and `member_expression` are optional.
    8591 <preset_link>::
    8692  Adds a link to an other preset. The `preset_name` attribute is required.
    87 [[BR]]
     93\\
     94
    8895==== Set a fixed key value pair ====
    8996 <key>::
    90   This tag will always set a key to a specific value. `key` is required and if `value` is present, the key will be set. If `value` attribute is ommited, the key is removed. The `match` attribute is optional.
    91 [[BR]]
     97  This tag will always set a key to a specific value. `key` is required and if `value` is present, the key will be set. If `value` attribute is omitted, the key is removed. The `match` attribute is optional.
     98\\
     99
    92100==== Attribute entry and selection dialog boxes ====
    93101 <text>::
     
    95103 <combo>::
    96104  Displays a multiple choice combo box. `key` and `values` are mandatory, `text`, `default`, `editable`, `delimiter`, `values_from`, `display_values`, `short_descriptions`, `use_last_as_default`, `values_searchable`, `length`, `values_no_i18n`, `values_sort` and `match` is optional.\\
    97   If editable is true (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values.
    98  <multiselect>::
    99   Displays a list from which zero or more items can be chosen. `key` and `values` are mandatory, and `text`, `default`, `delimiter`, `values_from`, `rows`, `display_values`, `short_descriptions`, `use_last_as_default`, `values_searchable`, `values_no_i18n`, `values_sort` and `match` are optional. The selected values will be concatenated with the specified delimiter (default: semicolon) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the multiselect will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the "combo" element, the "multiselect" expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify delimiter="," but then a comma will also be used in the tag value.
     105  If editable is `"true"` (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values.
     106 <multiselect>:: [=#multiselect]
     107  Displays a list from which zero or more items can be chosen. `key` and `values` are mandatory, and `text`, `default`, `delimiter`, `values_from`, `rows`, `display_values`, `short_descriptions`, `use_last_as_default`, `values_searchable`, `values_no_i18n`, `values_sort` and `match` are optional. The selected values will be concatenated with the specified delimiter (default: semicolon) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the `<multiselect>` will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the `<combo>` element, the `<multiselect>` expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify `delimiter=","` but then a comma will also be used in the tag value.
    100108 <list_entry>::
    101109  Used in <combo> and <multiselect>. More information see `short_descriptions`. The attributes are `value`, `display_value`, `short_description`, `icon` and `icon_size`.
    102110 <check>::
    103111  A checkbox which the user can select, deselect or set as unset. The `key` attribute is mandatory. `text`, `default`, `match`, `value_on` , `value_off`, `disable_off`, `icon` and `icon_size` (both since r15437) are optional.
    104 [[BR]]
     112\\
     113
    105114==== Templates ====
    106115 <chunk>::
     
    108117 <reference>::
    109118  To include an earlier defined template. The `ref` attribute is mandatory.
    110 [[BR]]
     119\\
     120
    111121=== Attributes ===
    112122The attributes of the tags have the following meaning:
     
    116126  Translation context for name attribute to separate equals words with different meaning (not required for in-file translations).
    117127 type="data_type"::
    118   When specified, only objects of the given type will work with this tagging preset. Can be "node", "way", "closedway", "multipolygon", "relation" or any comma separated combination of them. Note that "multipolygon" is not included in "relation", so if the preset should apply for multipolygons and other relation types, you need to specify both: "multipolygon,relation". Also used in the <role> tag to specify which object types are allowed for a specific relation member.
     128  When specified, only objects of the given type will work with this tagging preset. Can be `"node"`, `"way"`, `"closedway"`, `"multipolygon"`, `"relation"` or any comma separated combination of them. Note that `"multipolygon"` is not included in `"relation"`, so if the preset should apply for multipolygons and other relation types, you need to specify both: `"multipolygon,relation"`. Also used in the `<role>` tag to specify which object types are allowed for a specific relation member.
    119129 icon="iconname"::
    120   A name or link to an icon. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. Icons can also be used in <item>, <label> and <list_entry>. The icon should be quadratic in size. See [[Styles#Iconhandling]] how icons can be specified.
     130  A name or link to an icon. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. Icons can also be used in `<item>`, `<label>` and `<list_entry>`. The icon should be quadratic in size. See [wikitr:/Styles#Iconhandling Icon handling] how icons can be specified.
    121131 icon_size="a number"::
    122   The maximal size of an icon in px. If no value is given, default is 16 for <label> and the default icon size for <list_entry /> (in <combo> and <multiselect>).
     132  The maximal size of an icon in px. If no value is given, default is 16 for `<label>` and the default icon size for `<list_entry />` (in `<combo>` and `<multiselect>`).
    123133 key="some_key"::
    124   This specifies the property key that will be modified by the item. In case of <role> it is the role name used in a relation.
     134  This specifies the property key that will be modified by the item. In case of `<role>` it is the role name used in a relation.
    125135 text="Any text"::
    126   The description, that will be displayed before (after in case of <check>) the gui element. Also used for <label> and <optional>.
     136  The description, that will be displayed before (after in case of `<check>`) the gui element. Also used for `<label>` and `<optional>`.
    127137 text_context="context"::
    128138  Translation context for text attribute to separate equals words with different meaning (not required for in-file translations).
    129139 default="default_value"::
    130140  An explicitly declared default value for the item. This value is ''only'' applied through a preset when the object the preset is applied to has ''zero keys''.
    131   If no value for default is specified, no value is set to the key. Used in <check>, <text>, <combo> and <multiselect>.
     141  If no value for default is specified, no value is set to the key. Used in `<check>`, `<text>`, `<combo>` and `<multiselect>`.
    132142 values="entry1,entry2,entry3"::
    133   A list of entries (for the <combo> box and <multiselect>). The list has to be separated by commas (for the combo box) or by the specified delimiter (for the multiselect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
     143  A list of entries (for the `<combo>` box and `<multiselect>`). The list has to be separated by commas (for the combo box) or by the specified delimiter (for the multiselect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
    134144 values_from="JAVA code"::
    135   To use instead of "values" if the list of values has to be obtained with a Java method of this form: public static String[] getValues(); The value must be: "full.package.name.ClassName#methodName".
     145  To use instead of `values` if the list of values has to be obtained with a Java method of this form: `public static String[] getValues()`; The value must be: "full.package.name.ClassName#methodName".
    136146 values_no_i18n="true|false"::
    137   Disables internationalisation for value to avoid mistakes, see #11696. Default is "false". Used in <combo> and <multiselect>. (Useful e.g. for opening hours or brand names.)
     147  Disables internationalisation for value to avoid mistakes, see #11696. Default is `"false"`. Used in `<combo>` and `<multiselect>`. (Useful e.g. for opening hours or brand names.)
    138148 values_sort="false"::
    139   Values of <combo> and <multiselect> are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used e.g. for the keys "tracktype", "direction", "network", "smoothness", "visibility" or "trail_visibility".) Default is "true". Users can globaly disable sorting with the preference key `taggingpreset.sortvalues`.
     149  Values of `<combo>` and `<multiselect>` are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used e.g. for the keys `tracktype`, `direction`, `network`, `smoothness`, `visibility` or `trail_visibility`.) Default is `"true"`.\\
     150 Users can globally disable sorting with the preference key `taggingpreset.sortvalues`.
    140151 values_context="context"::
    141152  Translation context for values attribute to separate equals words with different meaning (not required for in-file translations).
    142153 display_values="Entry1,Entry2,Entry3"::
    143   A list of entries that is displayed to the user. Must be the same number and order of entries as `values` and `editable` must be false or not specified. For the delimiter character and escaping, see the remarks at `values`. Used in <combo> and <multiselect>.
     154  A list of entries that is displayed to the user. Must be the same number and order of entries as `values` and `editable` must be `"false"` or not specified. For the delimiter character and escaping, see the remarks at `values`. Used in `<combo>` and `<multiselect>`.
    144155 value="foobar"::
    145   Specify a value to be entered in the <key> tag.
     156  Specify a value to be entered in the `<key>` tag.
    146157 value_on="foobar"::
    147   Specify the true value to be entered in the <key> tag of a checked <check> (default is "yes").
     158  Specify the true value to be entered in the `<key>` tag of a checked `<check>` (default is `"yes"`).
    148159 value_off="foobar"::
    149   Specify the false value to be entered in the <key> tag of a unchecked <check> (default is "no").
     160  Specify the false value to be entered in the `<key>` tag of a unchecked `<check>` (default is `"no"`).
    150161 disable_off="true"::
    151   Whether the off value of a <check> is disabled in the dialog, i.e., only unset or yes are provided.
     162  Whether the off value of a `<check>` is disabled in the dialog, i.e., only unset or `"yes"` are provided.
    152163 editable="false"::
    153   The combo box is readonly, which means that the user can only select an item in the list. Default is "true", which means, the user can add other values as text.
     164  The combo box is read only, which means that the user can only select an item in the list. Default is `"true"`, which means, the user can add other values as text.
    154165 use_last_as_default="true|false|force"::
    155   For <combo>, <multiselect> or <text> fields the last value is used as default. Using "force" enforces this behaviour also for already tagged objects. Default is "false".
     166  For `<combo>`, `<multiselect>` or `<text>` fields the last value is used as default. Using `"force"` enforces this behaviour also for already tagged objects. Default is `"false"`.
    156167 rows="count"::
    157   Specify the number of rows to display in <multiselect> entry (if not set, it is auto determined by java or the look and feel and results in e.g. 8).
     168  Specify the number of rows to display in `<multiselect>` entry (if not set, it is auto determined by java or the look and feel and results in e.g. 8).
    158169 name_template="template", name_template_filter="search expression"::
    159170  Custom name formatter for osm primitives matching this preset. See below [[#name_templatedetails]] for details.
    160171 match="none|key|key!|keyvalue|keyvalue!"::
    161   Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wiki:Help/Dialog/TagsMembership Tags/Membership dialog].
    162   * none: neutral, i.e., do not consider this item for matching
    163   * key: positive if key matches, neutral otherwise
    164   * key!: positive if key matches, negative otherwise
    165   * keyvalue: positive if key and value matches, neutral otherwise
    166   * keyvalue!: positive if key and value matches, negative otherwise
    167 
    168   Note that for a match, at least one positive and no negative is required. Default is "keyvalue!" for <key> and "none" for <text>, <combo>, <multiselect> and <check>.
     172  Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wikitr:/Help/Dialog/TagsMembership Tags/Membership dialog].
     173  * `none`: neutral, i.e., do not consider this item for matching
     174  * `key`: positive if key matches, neutral otherwise
     175  * `key!`: positive if key matches, negative otherwise
     176  * `keyvalue`: positive if key and value matches, neutral otherwise
     177  * `keyvalue!`: positive if key and value matches, negative otherwise
     178
     179  Note that for a match, at least one positive and no negative is required. Default is `"keyvalue!"` for `<key>` and `"none"` for `<text>`, `<combo>`, `<multiselect>` and `<check>`.
    169180 id="unique_identifier"::
    170   the unique identifier for this chunk
     181  the unique identifier for this `<chunk>`
    171182 ref="unique_identifier"::
    172183  the unique identifier of the (already defined) template to include
    173184 columns="a number"::
    174   the number of columns of grouped checks
     185  the number of columns of grouped `<check>`
    175186 requisite="optional|required"::
    176   If a relation member is optional or required. Default is "optional".
     187  If a relation member is optional or required. Default is `"optional"`.
    177188 count="a number"::
    178189  How often can a role occur (if not given unlimited number is assumed)
     
    180191  an expression (cf. search dialog) for objects of this role
    181192 regexp="true"::
    182   set to true if the key of a role is a regular expression. This allows variable roles e.g. `<role key="level_-?\d+" text="Building level" regexp="true" requisite="optional" type="relation" />` allows the roles level_0, level_1,...
     193  set to `"true"` if the key of a role is a regular expression. This allows variable roles e.g. `<role key="level_-?\d+" text="Building level" regexp="true" requisite="optional" type="relation" />` allows the roles level_0, level_1,...
    183194 preset_name="exact_name"::
    184195  The exact name of the preset to link to.
    185196 preset_name_label="false|true"::
    186   Whether to insert "[preset name]" label in dialog (defaults to "false" for backward-compatibility on external presets).
     197  Whether to insert "[preset name]" label in dialog (defaults to `"false"` for backward-compatibility on external presets).
    187198 length="a number"::
    188   The length of a <text> or <combo> box (number of characters allowed).
     199  The length of a `<text>` or `<combo>` box (number of characters allowed).
    189200 alternative_autocomplete_keys="some_key(s)"::
    190   A comma separated list of alternative keys to use for autocompletion of <text>.
     201  A comma separated list of alternative keys to use for auto completion of `<text>`.
    191202 auto_increment="-2,-1,+1,+2"::
    192   May contain a comma separated list of integer increments or decrements, e.g. "-2,-1,+1,+2". A button will be shown next to the <text> field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with `use_last_as_default`.
     203  May contain a comma separated list of integer increments or decrements, e.g. `"-2,-1,+1,+2"`. A button will be shown next to the `<text>` field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with `use_last_as_default`.
    193204 delimiter="special character"::
    194   The character that separates values. In case of <combo> the default is comma. In case of <multiselect> the default is semicolon and this will also be used to separate selected values in the tag. More information see <multiselect>.
    195  short_descriptions=""Entry1,Entry2,Entry3"::
    196   A delimiter-separated list of texts to be displayed below each `display_value`. (Only if it is not possible to describe the entry in 2-3 words.) Instead of comma separated list instead using values, display_values and short_descriptions, the following form is also supported: <list_entry value="" display_value="" short_description="" icon="" icon_size="" />
     205  The character that separates values. In case of `<combo>` the default is ''comma''. In case of `<multiselect>` the default is ''semicolon'' and this will also be used to separate selected values in the tag. More information see `<multiselect>` [#multiselect above].
     206 short_descriptions="Entry1,Entry2,Entry3"::
     207  A delimiter-separated list of texts to be displayed below each `display_value`. (Only if it is not possible to describe the entry in 2-3 words.) Instead of comma separated list instead using `values`, `display_values` and `short_descriptions`, the following form is also supported: `<list_entry value="" display_value="" short_description="" icon="" icon_size="" />`
    197208 values_searchable="true|false"::
    198   Whether to search in <combo> or <multiselect> (display_)values when searching for presets.
     209  Whether to search in `<combo>` or `<multiselect>` (display_)values when searching for presets.
     210\\
    199211
    200212===== name_template details =====
    201 
    202 **Name templates can be used to define custom formatting for OSM primitives or GPX waypoints** (for example in the Relations or the Selection).
     213Name templates can be used to define custom formatting for OSM primitives or GPX waypoints (for example in the Relations or the Selection).
    203214
    204215{{{
     
    222233|| `{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)
    223234|| ||  `admin_level=2 name=Czech republic` (no parents) || 2 - Czech republic
     235\\
    224236
    225237====== Syntax ======
     
    227239* `?{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
    228240* `!{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.
     241\\
    229242
    230243====== Available values ======
     
    235248- `{special:id}` prints the ID of an osm primitive
    236249- `{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.
     250\\
    237251
    238252=== Deprecated Attributes ===
     
    243257 required="true"::
    244258  replaced by `match` since [5155]
     259\\
    245260
    246261== Translation ==
    247 To support translations, all textual elements ("name", "text", "display_values") may also be localized. E.g. "de.name" would represent the name in case the German language support is loaded. In the preset code the english term must be the first before possible translations are added.
    248 
    249 In JOSM internally ([source:josm/trunk/resources/data/defaultpresets.xml internal preset]) all "name", "text" and "display_values" are translated when no specific translation has been given in XML file. When no "display_values" are supplied, then "values" will be treated as "display_values" and translated instead. When translations of equal words but different meanings may conflict, a translation context should be specified. Use "name_context", "text_context" or "values_context" for this. The context should be a meaningful short description to help translators.
     262To support translations, all textual elements (`name`, `text`, `display_values`) may also be localized. E.g. `de.name` would represent the name in case the German language support is loaded. In the preset code the English term must be the first before possible translations are added.
     263
     264In JOSM internally ([source:josm/trunk/resources/data/defaultpresets.xml internal preset]) all `name`, `text` and `display_values` are translated when no specific translation has been given in XML file. When no `display_values` are supplied, then `values` will be treated as `display_values` and translated instead. When translations of equal words but different meanings may conflict, a translation context should be specified. Use `name_context`, `text_context` or `values_context` for this. The context should be a meaningful short description to help translators.
    250265
    251266The translation for the internal preset is done at [https://translations.launchpad.net/josm/trunk Launchpad] (and will probably change to another service in the future, since the Launchpad web interface often produces timeout errors, see #8645).
    252267
    253268== Icon handling ==
    254 See [wiki:Styles#Iconhandling Styles].
     269See [wikitr:/Styles#Iconhandling Styles].
    255270
    256271== See also ==
    257 * [wiki:Help/Menu/Presets Presets menu]
     272* [wikitr:/Help/Menu/Presets Presets menu]