[[TranslatedPages]]
[[PageOutline(2-10,Table of Contents)]]
''If you want to learn installation steps for presets, see [[JOSMImage(dialogs/propertiesdialog)]] [wikitr:/Help/Preferences/TaggingPresetPreference Tagging Presets] register in [[JOSMImage(preference)]] [wikitr:/Help/Action/Preferences Preferences]'' \\
''If you want to use presets or need complete reference of presets see [wikitr:/Presets Presets]''
----
= Tagging Presets =
JOSM supports distributed tagging presets. This is a XML config file that describes a GUI for entering tags (or properties, annotations, sometimes called map features).
The presets can be placed anywhere in the web or at the users local file system. JOSM can be configured to use custom local or remote Presets.
== Develop a new preset ==
The tagging preset description is in a very simple XML format. Details see [#XML below].
See the **[source:/trunk/resources/data/defaultpresets.xml defaultpresets.xml]** for an example covering most of the possibilities listed below.
Example:
[[Image(Change 1 object.png,right,link=,margin-left=15)]]
{{{
#!preset
}}}
\\
== XML Format description ==#XML
The 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].
=== Tags ===
==== The document prologue ====
::
Has to be the main tag of the file. Supports following attributes
* '''xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"'''
* '''author''' - the name of the author of the preset
* '''version''' - the version number of the file. For automatic version adjustment of presets managed in this wiki you have to use two internal variables: `[[revision]]` (the latest version number of the wiki page) and `[[date]]` (the date of the last edit), e.g. `version="1.[[revision]]_[[date]]"`.
* '''description''' (i18n) - description what the file contains
* '''shortdescription''' (i18n) - very short overview description i.e. the "name" of the preset
* '''link''' (i18n) - web link to further details (optional)
* '''icon''' - icon for the whole preset
* '''baselanguage''' - when the base language is not English, specify it here (using non English preset texts will prevent automatic translation, once it is implemented (#11392))
(i18n) means the values may also be localized (e.g. `de.description`).
\\
==== Comments ====
::
The document can contain embedded comments.
\\
==== Preset group creation ====
::
Used to group items in sub menus. `name` is required, `icon` is optional attribute.
::
Every item is one annotation set to select from. `name` is required, `type` and `preset_name_label` are recommended, `icon` and `name_template` are optional attributes.
::
Insert a line separator into the menu.
\\
==== Preset window layout ====
::
Labels are static texts for display. `text` is a required attribute, `icon` and `icon_size` are optional.
::
Add some space (i.e. a newline).
::
Used to group some optional elements of an item. The `text` attribute is optional. If used without `text` then this is equivalent to ``
::
Add a horizontal separator line between items.
::
Specify a web link for this feature or to anything else of use. Either the `wiki` (referring to an OSM wiki page, e.g. `"Tag:leisure=park"`) or the `href` (full URL) attribute is required. When the `wiki` attribute is used the link points to the wiki page of the language JOSM is set to. If it doesn't exist the English page is shown.
::
To group checks. The `columns` attribute is required.
::
This is required around `` and adds the heading ("Available roles role count elements") to the table which is generated by several ``.
::
To specify possible roles of members in relations. The `key` attribute is required, `text`, `requisite`, `count`, `type` and `member_expression` are optional.
::
Adds a link to an other preset with a label on top. The `preset_name` attribute is required, `text` to override the label (default is `"Edit also …"`) and `text_context` are optional. A sequence of `` without `text` or a identical `text` value are grouped below one label. \\
**Watch out** for presets with identical **`name`** as it is not predictable to which preset the link will lead to, see #12716. \\
Having the same tag in both presets does not work, see #18992. \\
Using `` in presets opened from [wikitr:/Help/Dialog/RelationEditor relation editor] produces unexpected changes, see #19392.
\\
==== Set a fixed key value pair ====
::
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.
\\
==== Attribute entry and selection dialog boxes ====#EntrySelectionBoxes
::
A text edit field to enter any arbitrary string from the user. `key` is mandatory, `text`, `default`, `use_last_as_default`, `auto_increment`, `length`, `alternative_autocomplete_keys`, `match`, `icon` and `icon_size` (both since r17605) are optional.
::
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`, `match`, `icon` and `icon_size` (both since r17605) are optional.\\
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.\\
If the key is `colour` or `colour:*` or `*:colour`, a color preview and color picker is added on the right (see #8352).
[=#multiselect]
::
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`, `match`, `icon` and `icon_size` (both since r17605) 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 `` 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 `` element, the `` 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.
::
Used in `` and ``. More information see `short_descriptions` [#short_description below]. The attributes are `value`, `display_value`, `short_description`, `icon` and `icon_size`.
::
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.
\\
==== Templates ====
::
To define a template of elements for later (repeated) use. The `id` attribute is mandatory.
::
To include an earlier defined template. The `ref` attribute is mandatory.
\\
=== Attributes ===
The attributes of the tags have the following meaning:
name="a_name"::
Specify a name for an item. This name will be used in the GUI to display the tagging preset.
name_context="context"::
Translation context for name attribute to separate equals words with different meaning (not required for in-file translations).
type="data_type"::
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 `` tag to specify which object types are allowed for a specific relation member.
icon="iconname"::
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 ``, ``, plus all [#EntrySelectionBoxes attribute entry and selection dialog boxes] (since r17605, before it was only `` and ``). It is placed in front of `` The icon should be quadratic in size. See [wikitr:/Styles#Iconhandling Icon handling] how icons can be specified.
icon_size="a number"::
The maximal size of an icon in px. If no value is given, default is 16 for `` and the default icon size for `` (in `` and ``).
key="some_key"::
This specifies the property key that will be modified by the item. In case of `` it is the role name used in a relation.
text="Any text"::
The description, that will be displayed before the gui element, (in case of `` after the gui element and the optional icon). Also used for `