Is it possible, in a JOSM tagging preset, to rename a key?
Obviously, I know key1 and key2, but I don’t know value.
I’ve looked at the documentation, and I’ve written the odd preset or two. I couldn’t figure out how to do this, though. Can it be done at all?
This is to modify objects (buildings) that have previously been imported from an official database. When they’re deleted from the database, this mostly means they’ve been demolished; in that case we delete the building from OSM. If they’re not demolished, however, we keep it on OSM and rename the key
. This isn’t terribly hard to do manually, but I’d love to save a mouse click or two by using an easy preset. If that’s possible.
This isn’t directly possible with JOSM, you can reference a Java method in the preset, but as you can’t pass it arguments (and would need to write a plugin to add it to JOSM itself) that doesn’t really help. So probably writing a simple plugin to do it is the only way, or maybe https://wiki.openstreetmap.org/wiki/JOSM/Plugins/ExtTools .
Thanks a lot, SimonPoole! Not the answer I wanted to hear, obviously. But if that’s what it is, that’s what it is.
Pretty cool that Vespucci can do this. I wonder how easy or hard it would be to add that capability to JOSM…
Actually on 2nd thought you might be able to do this with value_template see https://josm.openstreetmap.de/wiki/TaggingPresets which is a very new and rather controversial addition (it isn’t quite clear if it still works or not, but it is worth a try).
That doesn’t work, as of JOSM 18193, for two reasons
value_templates appear to be forbidden in ‘key’ statements; only value appears to be supported
If I insert the value_template into a ‘text’ statement like in the clunky working example above, it first populates “newTag” with the value of oldTag as needed. But then it deletes “oldTag” in the second statement and dynamically updates the value_template above, i.e., it deletes the value… That’s why I currently need two steps.
Am I doing something stupid, or do I need to raise a feature request “allow value_template in key”?
I don’t think using a field would do anything different, the problem is likely simply the point in time the template is evaluated, but there might be a way around this (as with all such things banking on a specific undocumented implementation detail is not good practice :-)).