Customising JOSM Presets

From OpenStreetMap Wiki
Jump to navigation Jump to search

General

JOSM provides a range of templates. Since each mapper only works with a subset of objects, it is sometimes useful to add presets to the list or to delete unused parts.

The basic templates are already built into JOSM. Additional templates are provided by third-parties, or you can make it yourself. Templates are stored in XML format. The examples on this page use a file called eg-presets.xml. Simply yourself (eg with Notepad or gedit and rename as XML), save to your local disk and in the JOSM settings (Edit - Preferences - Settings of the map projection and data interpretation ('Gitternetz' icon) - (tab) object templates - Active Object Template) specify the path. You can add as many template files as you like.

For more information study the files defaultpresets.xml and tagging-preset.xsd. (Both files can be found in the data/ directory in the josm.jar file, and can be extracted using any zip utility.)

It is important that the file is saved in UTF8 format, otherwise special characters are not displayed correctly.

Presets

The 'presets' tag is where you insert items or groups

<presets>
    <!-- Items or groups -->
</presets>

Group

The 'group' tag encloses one or more items. It has at least a name, optionally also a Icon.

<group name="HVV-Buslinien" icon="O:/OSM/busgroup.png">
   <!-- Here several items -->
</group>

Item

The 'item' tag describes a single preset. It has at least a name, optionally also an Icon.

<item name="Merker" icon="presets/Stop.png">
    <!-- Descriptive elements here -->
</item>

Descriptive elements can be:

Link

Displays a link to a page in this wiki.

Example:

<link href="Tag:leisure=slipway" />

Language specific pages can be linked to by prepending the locale id to href.

Example:

<link href="Tag:leisure=slipway"
   de.href="DE:Tag:leisure=slipway"
   fi.href="FI:Tag:leisure=slipway"
/>

Key

The object will be tagged with this key and value. The key will not appear in the dialog box but will be applied whenever this item is invoked.

Example:

<key key="amenity" value="restaurant" />

Text

Opportunity for free text entry for the user

Example:

<text key="name" text="Name:" default="" />

Used in the presentation of the Key text, then this applies to all languages as a base. To be able to spend are also country-specific texts to use separate keys. The keys are then locales preceded.

In the default presets only English words are stored. The country-specific texts are controlled there over the translation package.

Example:

<text key="name" text="Operator:" de.text="Betreiber:" default="" />

Space

Inserts a blank line in the dialog box.

Example:

<space />

Check

Querying a truth value (true / false)

Example:

<check key="fuel_octane_98" text="98 Octane" default="off" />

Combobox

Provides the user a list of possible values for the key from which a single selection may be made. This way typos during mapping can be avoided. Users can pick only one value from the supplied list.

Example:

<combo key="tourism" text="Accomodation:" values="hotel,motel,guest_house" default="" />

Multiselect

Provides the user a list of possible values for the key from which selection(s) may be made. Users may select any number of those values to be applied to the object.
The separator (delimiter) of the individual values can be optionally specified with delimiter="[x]". A default adjusted separator ";" can usually the Keywerte will be separated not used since then with this character.

Example:

<multiselect key="operator" delimiter="," text="operator" de.text="Betreiber the Halteposition" values="VAS,JES,VAS;JES" />

Description of the attributes of each item

Key

stands for the key being assigned to the object

Value

The value to be assigned to the key

  • Required attribute in key

Text

Caption element in it Formula

Default

Starting value

In check the value 'on' or 'off' should be used.

Delete_if_empty

The key will be applied to the object only if it is set

Deprecated since JOSM v5155. The attribute delete_if_empty is the default behaviour now so you can simply remove it from your presets.

Values

Default values for a combobox, separated by commas (example).

Icon

The path to an icon.

The path is an absolute filename (example), or relative to the internal icon set

The icon should be in PNG or SVG format and be square. Furthermore, the background color should be transparent, as it might look strange in the toolbar otherwise.

Type

Description of what type of object the item is admissible
. Valid values are: 'node'=a node, 'way' a distance 'closedway' an area, 'Relation' a relation that is not a multipolygon. 'multipolygon' a multipolygon. In dialogue with their symbols are shown.

Multiple values are separated by commas ie allowed:

<item name="Fountain" icon="presets/spring.png" type="node,closedway">
    <!-- Descriptive elements here -->
</item>
  • Optional attribute in item

Name

Text that is displayed in the menu or the toolbar

Use_last_as_default

Attribute to the values of the last input to accept the default value automatically. Found, for example application in the detection of addresses.

Possible values are true / false.

Display_values

A comma-separated list of values to be an alternative for the entries of the parameter value shown. The order must match the value of. For German-speaking de.display_values values may alternatively be used (see also text).


Short_description

For each of the values in the parameter display_value', a short description will be deposited and the sequence must match those of display_values here. The brief descriptions here are structured as follows:

<short_description> first description </short_description>
...
<short_description> last description </short_description>

(Where this information is displayed in JOSM? JOSM In 5667 they are at least not displayed. Below Detached works though.)

Alternatively, the list of options in a string parameter in a comma-separated list and the list of values, each with its own day is possible:

<combo key="" text="">
    <list_entry value="erster Wert" display_value="ein Wert" short_description="erste Beschreibung" />
    <list_entry value="zweiter Wert" display_value="ein other Wert" short_description="zweite Beschreibung" />
</combo>


Examples of presets

It does not always get a dialog so that tags can be assigned. There is always the key of only one key-value pair, then only the data is assigned.

One-click Example

<item name="1Click-bridge" de.name="1-Klick-Bruecke" icon="present/bridge.png" type="way,closedway">
    <key key="bridge" value="yes" />
    <key key="layer" value="1" />
</item>

Other examples of the collection of road data can be found in OneClick Preset.

Gas Station

<item name="Petrol / Gas Station">
    <link href="https://wiki.openstreetmap.org/wiki/DE:Tag:amenity=fuel" />
    <label text="Tankstelle" />
    <key key="amenity" value="fuel" />
    <combo key="name" text="Name" values="Shell,BP,Esso,Murco" default="" />
    <combo key="brand" text="Brand" values="Shell,BP,Esso,Murco" default="" />
    <check key="fuel:diesel" text="Diesel" />
    <check key="fuel:octane_91" text="Petrol 91 octane " />
    <check key="fuel:octane_95" text="Petrol 95 octane" />
    <check key="fuel:octane_98" text="Petrol 98 octane" />
    <check key="fuel:biogas" text="Biogas" />
    <check key="fuel:lpg" text="LPG" />
    <check key="fuel:hydrogen" text="Wasserstoff" />
    <check key="fuel:electricity" text="Charger for electric cars" />
    <optional>
        <text key="opening hours" text="Opening Hours" default="" />
        <link href="https://wiki.openstreetmap.org/wiki/Key:opening_hours?uselang=en" />
        <check key="payment:maestro_card" text="Master-Card" default="off" />
        <check key="payment:banknotes" text="Cash" default="off" />
    </optional>
</item>

Health & Beauty Shops

<item name="Chemist">
    <link href="https://wiki.openstreetmap.org/wiki/DE:Map_Features#Gesch.C3.A4fte" />
    <label text="Drogerie" />
    <key key="shop" value="chemist" />
    <text key="name" text="name" />
    <combo key="brand" text="Chain" values="Boots,Superdrug" default="" />
</item>

Bus stop of the Hamburg Transport Association

<item name="HVV Bushaltestelle">
    <link href="https://wiki.openstreetmap.org/wiki/DE:Tag:highway=bus_stop" />
    <label text="Bus Stop" />
    <key key="highway" value="bus_stop" />
    <text key="name" text="Schildname (name)" />
    <text key="network" text="Netz (network)" default="HVV" />
    <combo key="operator" text="Operator" values="VHH,HHA,PVG,KVG,AK,KVIP" default="" />
    <check key="shelter" text="Shelter" default="off" />
</item>

Bus Route of the Hamburg Transport Association (relation)

<item name="HVV-Buslinie" type="relation">
    <link />
    <label text="HVV bus bearbeiten" />
    <key key="type" value="route" />
    <key key="route" value="bus" />
    <key key="network" value="HVV" />
    <text key="ref" text="Linie (ref)" />
    <text key="name" text="Name" default="HVV-Buslinie xxx" />
    <optional>
        <combo key="operator" text="Betreiber (operator)" values="VHH,HHA,PVG,KVG,AK,KVIP" default="HHA" />
        <text key="from" text="Von" />
        <text key="to" text="Nach" />
        <text key="note" text="Bemerkung" />
    </option>
</item>


Bike Rental (in conjunction with StadtRADHamburg)

see also # bicycle hire howto Map A

<item name="Fahrrad-Verleih">
    <link href="https://wiki.openstreetmap.org/wiki/DE:Howto_Map_A#Fahrrad-Verleih" />
    <label text="Fahrrad-Verleih" />
    <key key="amenity" value="bicycle_rental" />
    <text key="name" text="Name" />
    <text key="network" text="Betreiber" default="stadtradhamburg" />
    <text key="ref" text="station no." default="" />
    <text key="capacity" text="Anzahl Stellplätze" default="" />
</item>


A list of the tags below to find is Category: Tags and [Tags by value] [: Category].

Milestones

<item name="Meilenstein">
    <link href="https://wiki.openstreetmap.org/wiki/DE:Howto_Map_A#Meilensteine" />
    <label text="Milestones" />
    <key key="historic" value="milestone" />
    <text key="name" text="Name" default="" />
    <text key="year" text="Jahr" default="" />
    <text key="ref" text="km" default="" />
    <check key="moved" text="No longer in original location" default="off" />
</item>

Cycling and footpath combinations

This template takes into account describes the various combinations of walking and cycling paths as in [1].

<annotations>
    <group name="Fuss-Rad-Weg" icon="presets/cycleway.png">
    <item name="Fussweg-Rad (239+Zusatz)" icon="presets/cycleway.png">
        <label text="Fussweg (Rad frei) bearbeiten"/>
        <link href="https://wiki.openstreetmap.org/wiki/DE:Bicycle/overview_ways" />

        <label text=" "/>
        <key key="highway" value="path"/>
        <key key="foot" value="designated"/>
        <key key="bicycle" value="yes"/>
        <label text=" "/>
        <label text="Optional Attributes:" de.text="Zusatzinformationen:"/>
        <label text=" "/>
        <text key="name" text="Name" de.text="Name" default="" />
        <check key="oneway" text="Oneway" de.text="Einbahn" default="off" />
        <check key="bridge" text="Bridge" de.text="Brücke" default="off" />
        <check key="tunnel" text="Tunnel" de.text="Unterführung" default="off" />
        <check key="cutting" text="Cutting" de.text="Einschnitt" default="off" />
        <check key="embankment" text="Embankment" de.text="Damm/Rampe" default="off" />
        <combo key="layer" text="layer" de.text="level" values="5,4,3,2,1,0, -1, -2, -3, -4, -5" default="" />
        <combo key="surface" text="Surface" de.text="Oberfläche" values="paved,unpaved,cobblestone" default="" />
        <text key="maxspeed" text="Max. speed (km/h)" de.text="max. speed (km/h)" default="" />
        <text key="width" text="Width (metres)" de.text="Breite (Meter)" default="" />
    </item>
    <item name="Fuss-|Radweg (240)" icon="presets/cycleway.png">
        <label text="Fuss-|Radweg bearbeiten"/>
        <link href="https://wiki.openstreetmap.org/wiki/DE:Bicycle/overview_ways" />
        <label text=" "/>
        <key key="highway" value="path"/>
        <key key="foot" value="designated"/>
        <key key="bicycle" value="designated"/>
        <key key="segregated" value="no"/>
        <label text=" "/>
        <label text="Optional Attributes:" de.text="Zusatzinformationen:"/>
        <label text=" "/>
        <text key="name" text="Name" de.text="Name" default="" />
        <check key="oneway" text="Oneway" de.text="Einbahn" default="off" />
        <check key="bridge" text="Bridge" de.text="Brücke" default="off" />
        <check key="tunnel" text="Tunnel" de.text="Unterführung" default="off" />
        <check key="cutting" text="Cutting" de.text="Einschnitt" default="off" />
        <check key="embankment" text="Embankment" de.text="Damm/Rampe" default="off" />
        <combo key="layer" text="layer" de.text="level" values="5,4,3,2,1,0, -1, -2, -3, -4, -5" default="" />
        <combo key="surface" text="Surface" de.text="Oberfläche" values="paved,unpaved,cobblestone" default="" />
        <text key="maxspeed" text="Max. speed (km/h)" de.text="max. speed (km/h)" default="" />
        <text key="width" text="Width (metres)" de.text="Breite (Meter)" default="" />
    </item>
    <item name="Rad-|Fussweg (241)" icon="presets/cycleway.png">
        <label text="Rad-|Fussweg bearbeiten"/>
        <link href="https://wiki.openstreetmap.org/wiki/DE:Bicycle/overview_ways" />
        <label text=" "/>
        <key key="highway" value="path"/>
        <key key="foot" value="designated"/>
        <key key="bicycle" value="designated"/>
        <key key="segregated" value="yes"/>
        <label text=" "/>
        <label text="Optional Attributes:" de.text="Zusatzinformationen:" />
        <label text=" "/>
        <text key="name" text="Name" de.text="Name" default="" />
        <check key="oneway" text="Oneway" de.text="Einbahn" default="off" />
        <check key="bridge" text="Bridge" de.text="Brücke" default="off" />
        <check key="tunnel" text="Tunnel" de.text="Unterführung" default="off" />
        <check key="cutting" text="Cutting" de.text="Einschnitt" default="off" />
        <check key="embankment" text="Embankment" de.text="Damm/Rampe" default="off" />
        <combo key="layer" text="layer" de.text="level" values="5,4,3,2,1,0, -1, -2, -3, -4, -5" default="" />
        <combo key="surface" text="Surface" de.text="Oberfläche" values="paved,unpaved,cobblestone" default="" />
        <text key="maxspeed" text="Max. speed (km/h)" de.text="max. speed (km/h)" default="" />
        <text key="width" text="Width (metres)" de.text="Breite (Meter)" default="" />
    </item>
    </group>
</annotations>

Additional references