| | 1 | = Tagging Presets = |
| | 2 | 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. |
| | 3 | |
| | 4 | |
| | 5 | = Setup = |
| | 6 | Every user can choose to add any url (or filename) into his preferences. The image on the right shows an example of some urls. The file:// prefix for local files is optional and the line could also be written as {{{/home/tweety/josm-annotations/de-streets.xml}}}. |
| | 7 | |
| | 8 | [[Image(josm-preferences.png)]] |
| | 9 | |
| | 10 | |
| | 11 | After the sources are specified (and after a restart), the tagging presets can be selected from the uppermost combo box in the properties dialog. |
| | 12 | |
| | 13 | [[Image(josm-tagging-presets.png)]] |
| | 14 | |
| | 15 | |
| | 16 | I plan to include some tagging preset files which are good looking, clean and usable for general purpose to ship with the JOSM code. (Read this as: "I am awaiting your files!" ;-) ). |
| | 17 | |
| | 18 | In the lang-de plugin, a basic tagging preset for typical german tagging is included. |
| | 19 | |
| | 20 | |
| | 21 | == Example == |
| | 22 | Here is another example of how it looks like: |
| | 23 | |
| | 24 | [[Image(tagging_screenshot.png)]] |
| | 25 | |
| | 26 | |
| | 27 | And this is the code that created the example: |
| | 28 | {{{ |
| | 29 | <presets> |
| | 30 | <item name="Highway"> |
| | 31 | <label text="Inserting a highway in UK" /> |
| | 32 | |
| | 33 | <text key="name" text="Highway (e.g. M3)" /> |
| | 34 | <combo key="highway" text="Type" values="major,minor" delete_if_empty="true" /> |
| | 35 | |
| | 36 | <!-- Highways are usually oneway --> |
| | 37 | <check key="oneway" text="Oneway" default="on" /> |
| | 38 | |
| | 39 | <!-- Always setting class=highway --> |
| | 40 | <key key="class" value="highway" /> |
| | 41 | </item> |
| | 42 | </presets> |
| | 43 | }}} |
| | 44 | |
| | 45 | |
| | 46 | == XML Format description == |
| | 47 | |
| | 48 | The tagging preset description is in a very simple XML format. The format is not validated. |
| | 49 | |
| | 50 | === Tags === |
| | 51 | The following tags are used: |
| | 52 | '''<presets>''':: |
| | 53 | Has to be the main tag of the file. No Attributes are recognized. The old tag "annotations" is still possible but deprecated. |
| | 54 | '''<item>''':: |
| | 55 | Every item is one annotation set to select from. ''name'', ''icon'' and ''type'' are optional attribute. |
| | 56 | '''<label>''':: |
| | 57 | Labels are static texts for display. ''text'' is a required attribute. |
| | 58 | '''<text>''':: |
| | 59 | A text edit field to enter any arbitrary string from the user. ''key'' is mandatory, ''text'' and ''default'' is optional |
| | 60 | '''<combo>''':: |
| | 61 | Displays a multiple choice combo box. ''key'' and ''values'' are mandatory and ''text'', ''default'' and ''readonly'' is optional. |
| | 62 | If readonly is not set, combo boxes can be edited as if they were text fields (additional to the drop down menu). Readonly |
| | 63 | combo boxes can only contain one of the specified values. |
| | 64 | '''<check>''':: |
| | 65 | A checkbox which the user can only select or deselect. The ''key'' attribute is mandatory. ''text'' and ''default'' is optional. |
| | 66 | '''<key>''':: |
| | 67 | 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 |
| | 68 | ''value'' attribute is ommited, the key is removed. |
| | 69 | |
| | 70 | === Attributes === |
| | 71 | The attributes of the tags have the following meaning: |
| | 72 | '''name="a_name"''':: |
| | 73 | Specify a name for an item. This name will be used in the GUI to display the tagging preset. |
| | 74 | '''type="data_type"''':: |
| | 75 | 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. |
| | 76 | '''icon="iconname"''':: |
| | 77 | 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. |
| | 78 | '''key="some_key"''':: |
| | 79 | This specifies the property key that will be modified by the item. |
| | 80 | '''text="Any text"''':: |
| | 81 | The description, that will be displayed before (after in case of <check>) the gui element. |
| | 82 | '''default="default_value"''':: |
| | 83 | The default value for the item. If not specified, the current value of the key is choosen as default (if applicable). |
| | 84 | '''delete_if_empty="true"''':: |
| | 85 | If the text (or combo) box is left empty, the key is removed instead inserting an key with empty value. Default is "false". |
| | 86 | '''readonly="true"''':: |
| | 87 | Set the combobox to readonly mode, where the user can not edit the value directyl but only may chosse a value from the list. Combine this with '''default''' to force the user to always set some value. |
| | 88 | '''values="entry1,entry2,entry3"''':: |
| | 89 | A comma seperated list of entries (for the combo box). It is not possible to specify an entry that contain a comma. |
| | 90 | '''display_values="Entry1,Entry2,Entry3"''':: |
| | 91 | A comma seperated 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. |
| | 92 | '''value="foobar"''':: |
| | 93 | Specify a value to be entered in the <key> tag. |
| | 94 | '''focus="true"''':: |
| | 95 | The item gets the focus when the dialog is activated. Does only work for text fields like <text> and <combo>. |