JOSM Search and Replace?

I wish to edit the name key of a group of nodes to fix typos and normalize data. For instance, I want to change the first character of names places starting with "El " to "el ".

Currently I have a good filter rule in JOSM, so I can edit each node by hand easilly. But I would be easier selecting all desired nodes and replacing "El " to "el " with a single click. There are many typos in many nodes.

Is it possible to do what I’m seeking?

Thanks for your help!

Joan Montané

What you want to do is possible after you install the scripting plugin. Let me know if you want an example in Python.

Jo

Thanks for quick reply,

yes, please provide me a sample basic script. Days ago I installed script plugin, but I’m unable to achieve nothing usefull.

Something like:

Iterate in each node/way/relation in user’s current selection
If name match a regex ("El "), replace name with regex (s/^El /el /).

Regards,
Joan Montané

First of all, you have to install Jython and tell the scripting plugin where to find its executable.

This is probably more than you bargained for:

http://josm.openstreetmap.de/wiki/Help/Plugin/Scripting/Python/RCN_Route_Validator

You’ll have to remove a lot for your purpose, but it’s all there; iterating over objects in the selection, regular expressions. I hope it can inspire you.

Jo

Thanks! I’ve created a simple proof-of-concept script, :slight_smile: Now I’m dealing with undo-feature.

Regards,
Joan Montané