OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2019-08-18 14:11:52

Shohreh
Member
Registered: 2012-12-15
Posts: 184

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

Hello,

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.

Last edited by Shohreh (2019-08-21 13:03:58)

Offline

#2 2019-08-21 07:17:50

escada
Moderator
Registered: 2011-08-13
Posts: 1,558

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

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"/>
                                        <roles>
                                                <role key="" text="route" requisite="required" type="way" member_expression="highway"/>
                                        </roles>
                                </item>

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.

Offline

#3 2019-08-21 12:53:31

Shohreh
Member
Registered: 2012-12-15
Posts: 184

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

Thanks, it worked right the first time :-)

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 :

https://josm.openstreetmap.de/browser/j … es/presets

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.

Last edited by Shohreh (2019-08-21 14:25:18)

Offline

#4 2019-08-22 10:24:45

Shohreh
Member
Registered: 2012-12-15
Posts: 184

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

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"
  icon="oneclick.png"
  fr.shortdescription="Blah"
  fr.description="Blah">
  
  <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" />
		<roles>
		        <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"/>
		</roles>
	</item>
</presets>

Offline

Board footer

Powered by FluxBB