wiki:TaggingPresets

Version 7 (modified by dmgroom, 17 years ago) ( diff )

more updates for version 399

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 http://ostertag.name/osm/annotations/uk-highway.xml (a file on ostertag.name). Alternatively there are some larger files checked in here: http://trac.openstreetmap.org/browser/applications/editors/josm/annotation_presets

The image on the right shows an example of some urls (these URLs were since moved though)

No image "josm-preferences.png" attached to TaggingPresets

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. The old tag "annotations" is still possible but deprecated.
<item>
Every item is one annotation set to select from. name, icon and type are optional attribute.
<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", "segment", "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".
readonly="true"
Set the combobox to readonly mode, where the user can not edit the value directly but only may chose a value from the list. Combine this with default to force the user to always set some value.
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>.

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.