|Version 23 (modified by Michi, 3 years ago) (diff)|
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 XML files can be placed anywhere in the web or at the users local file system. Presets can be added by the users at a central page Presets.
Every user can choose to add any url (or filename) into his preferences. An example URL is included in JOSM SVN.
After the sources are specified (and after a restart), the tagging presets can be selected from the main menu.
Here is an example of how it looks like:
And this is the code that created the example :
<presets> <item name="Highway"> <label text="Inserting a highway in UK" /> <text key="name" text="Highway (e.g. M3)" /> <combo key="highway" text="Type" values="major,minor" delete_if_empty="true" /> <!-- Highways are usually oneway --> <check key="oneway" text="Oneway" default="on" /> <!-- Always setting class=highway --> <key key="class" value="highway" /> </item> </presets>
XML Format description
The tagging preset description is in a very simple XML format. The format is not validated.
The following tags are used:
- Has to be the main tag of the file. No Attributes are recognized.
- 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, icon is optional attribute.
- Add an separator in menu.
- Used to group some optional elements of an item.
- Add some space in the preset display.
- Specify web link for this feature. href is required.
- Labels are static texts for display. text is a required attribute.
- A text edit field to enter any arbitrary string from the user. key is mandatory, text and default is optional
- Displays a multiple choice combo box. key and values are mandatory and text, default and readonly is optional. If readonly is not set, combo boxes can be edited as if they were text fields (additional to the drop down menu). Readonly combo boxes can only contain one of the specified values.
- A checkbox which the user can only select or deselect. The key attribute is mandatory. text and default is optional.
- 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 attributes of the tags have the following meaning:
- Specify a name for an item. This name will be used in the GUI to display the tagging preset.
- When specified, only objects of the given type will be changed at all by this tagging preset. Can be "node", "relation", "way" or any comma separated combination of them.
- A name of an icon that is within any classpath in the subdirectory of /images/symbols. You can load plugin-jar's to provide those images as well. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. The icon should be quadratic in size.
- This specifies the property key that will be modified by the item.
- text="Any text"
- The description, that will be displayed before (after in case of <check>) the gui element.
- The default value for the item. If not specified, the current value of the key is chosen as default (if applicable).
- If the text (or combo) box is left empty, the key is removed instead inserting an key with empty value. Default is "false".
- A comma separated list of entries (for the combo box). It is not possible to specify an entry that contain a comma.
- A comma separated list of entries that is displayed to the user. Must be the same number of entries as values and readonly must be true or not specified.
- Specify a value to be entered in the <key> tag.
- The item gets the focus when the dialog is activated. Does only work for text fields like <text> and <combo>.
- The combo box is readonly, which means, the user can only select an item in the list.
To support translations, all textual elements may be used in translated form. E.g. "de.name" would represent the name in case German language support is loaded.