Version 18 (modified by 16 years ago) ( diff ) | ,
---|
Tagging Presets
Since revision 117, Josm supports distributed tagging presets (formerly known as "annotation 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.
Setup
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.
In the lang-de plugin, a basic tagging preset for typical german tagging is included.
Example
Here is another 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.
Tags
The following tags are used:
- <presets>
- Has to be the main tag of the file. No Attributes are recognized.
- <group>
- Used to group items in sub menus. name is required, icon is optional attribute.
- <item>
- Every item is one annotation set to select from. name is required, icon is optional attribute.
- <separator>
- Add an separator in menu.
- <optional>
- Used to group some optional elements of an item.
- <space>
- Add some space in the preset display.
- <link>
- Specify web link for this feature. href is required.
- <label>
- Labels are static texts for display. text is a required attribute.
- <text>
- A text edit field to enter any arbitrary string from the user. key is mandatory, text and default is optional
- <combo>
- 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.
- <check>
- A checkbox which the user can only select or deselect. The key attribute is mandatory. text and default is optional.
- <key>
- 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.
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.
- type="data_type"
- 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.
- icon="iconname"
- 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.
- key="some_key"
- 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.
- default="default_value"
- The default value for the item. If not specified, the current value of the key is chosen as default (if applicable).
- delete_if_empty="true"
- If the text (or combo) box is left empty, the key is removed instead inserting an key with empty value. Default is "false".
- values="entry1,entry2,entry3"
- A comma separated list of entries (for the combo box). It is not possible to specify an entry that contain a comma.
- display_values="Entry1,Entry2,Entry3"
- 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.
- value="foobar"
- Specify a value to be entered in the <key> tag.
- focus="true"
- The item gets the focus when the dialog is activated. Does only work for text fields like <text> and <combo>.
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.
Attachments (3)
- tagging_screenshot.png (6.9 KB ) - added by 17 years ago.
- TaggingPresets.png (51.8 KB ) - added by 13 years ago.
- Change 1 object.png (31.2 KB ) - added by 9 years ago.
Download all attachments as: .zip