[SOLVED] [JOSM] Custom preset to add relation?


I need to create a custom preset that will…

  • add a couple of key=value tags

  • create a relation that will include a few nodes and open ways that the user selected with SHIFT+mouse before applying this preset, add those objects to the relation, and set a specific role to each item

As a work-around than trying to figure it out from this complex sample, would someone have a similar preset handy that I could use to build my own?

Thank you.

I once wrote

                             <item name="RWN Route" nl.name="Wandelknooppunt route" icon="presets/misc/route.svg" type="relation">
                                        <!-- link href="" /> -->
                                        <label text="Edit Route" nl.text="Wijzig wandelknooppuntroute"/>
                                        <space />
                                        <key key="type" value="route"/>
                                        <key key="route" value="foot"/>
                                        <key key="network" value="rwn"/>
                                        <text key="note" text="Between Nodes (xx-yy)" nl.text="Tussen knooppunten (xx-yy)"/>
                                        <check key="fixme" value_on="incomplete" value_off="" text="Incomplete?" nl.text="Onvolledig?" default="off"/>
                                                <role key="" text="route" requisite="required" type="way" member_expression="highway"/>

everything that was selected before the preset was called will be added as members. In my case none of the members get a role

From my experience with e.g. the turn restriction relations, the order in which you select the items will be preserved, i.e. the first selected item will be the first member of the relation.

Thanks, it worked right the first time :slight_smile:

I just need to find the right icon for Turn Restrictions to fill the “icon” key in “item” (as well as in the “presets” enclosure).

There’s nothing in "c:\Program Files\JOSM", although there is stuff in "c:\Users\joe\AppData\Local\JOSM\cache\images" but I assume they’re fetched by JOSM from the web.

Edit: Never mind, it’s here :


Thank you very much.

Edit: As cherry on the pie, is there a way to get rid of the “Change 0 objets” dialog that pops up after clicking on the icon in the toobar, and before moving to the next dialog through the “New relation” button where the user adds tags and roles? It saves one step.

I notice something strange: Even after restarting JOSM, the preset assigns “from” as role for both ways, so that I must manually change it to “to”.

<?xml version="1.0" encoding="UTF-8"?>
<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"
  <item name="Blah" fr.name="Blah" icon="presets/vehicle/restriction/give_way.svg" type="relation">
		<label text="Blah" fr.text="Blah" />
    <label text="---------------------------" />

		<key key="type" value="relation"/>
		<key key="restriction:bicycle" value="give_way"/>
    <key key="source" value="Survey" />
		        <role key="from" text="from" requisite="required" type="way" member_expression="highway"/>
		        <role key="via" text="via" requisite="required" type="node" member_expression="traffic_signal"/>
		        <role key="to" text="to" requisite="required" type="way" member_expression="highway"/>