Automated task

Hi All,

In my country, Iran, because of difficulties in standard Persian keyboard layout especially in Microsoft Windows, users type numbers in English. Thus, in OpenStreetMap editors, either iD or JOSM, most of the numbers in “name” tags are written in English. As much as I know, this is not correct based on OSM rules. Besides, it has aesthetically problems viewing maps.

I Know that there are bots that can do repetitive tasks in OSM. I want a way (or maybe a bot) that converts English numbers in “name” tag to Persian numbers inside Iran territory.

here is Numbers table:

0 1 2 3 4 5 6 7 8 9

۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹

Bots would normally be written by someone with a personal interest in the problem that they address, not by any central organisation.

However, in my case, I feel that such a bot would not be considered safe I think the preference would be to add plugins to JOSM that assisted in initial entry or one by one conversion of tag values using the Arabic forms of the numerals. Again that would be up to someone with programming skills and an interest coming forward.

For iD, the best solution might be a customised version of iD, as, being a beginners’ editor, one wouldn’t want to confuse the user interface with specialist features.

Note that there is a lot more than names that would need this treatment. On the other hand one would not want to do the conversion where the value was actually used as a number (e.g. maxheight, opening_hours etc.). Whilst addr:housenumber might not be fussy, address interpolations would probably need to use the Western numerals.

Have you looked to see what happens in other regions using similar scripts? I see that there are numerous names written in Arabic (see http://taginfo.openstreetmap.org/keys/name:ar ), have they found a means of dealing with this?

If the practice of using ‘western’ numerals is now standard in OSM Iran, it might be best to have some discussion with other contributors there before proceeding. I see that there is no forum, and the mailing list is pretty inactive, but once you start changing this, then ideally every contributor should be doing so.

Thanks for your answer.
I’m No. 1 mapper in Iran and I know that this is right. But, I don’t know coding and I don’t know How! If JOSM had a Search&Replace function I could do that little by little manually. But JOSM has no Replace function, too. :frowning:

In this diary entry http://www.openstreetmap.org/user/escada/diary/28268 I describe how you can use Overpass, the Level0 editor and a text editor to do search and replace. Perhaps this is useful for your case.

Please note that this is similar to a mechanical edit and you have to follow a certain procedure.

Cross post: https://help.openstreetmap.org/questions/47242/automated-task-english-numbers-to-persian-numbers

**Please don’t post the same question and answers across several forums! **

Thanks for your nice help. That’s almost what I want.

Excuse me! I didn’t know OpenstreetMap Forum and Help are the same.

The issue is that they are different. Asking in more than one place at a time means that people can waste there time by repeating answers already given, or can give answers based on wrong assumptions, that have been clarified elsewhere.

Normally you should only ask elsewhere if your first forum dries up, and you should always reference the two threads from each other.

Hi escada,

You introduced really useful services, I’m thankful. I converted what I wanted in a city. But, I want to search Numbers and numbers are all over the generated file (objects ID number, location point numbers, …), How can I search and replace numbers only in “name” tag?

Hello Kesler,

there are some postings here and there that experienced OSM users have utilizied the tool called

https://en.wikipedia.org/wiki/Sed

Do you know that command line tool?

Or have you ever worked with https://en.wikipedia.org/wiki/Regular_expression to find and replace the numbers you have in aim?

with a regular expression you should be able to search only in the name field. Something like

name=[a-zA-Z0-9 ]+

will be a first attempt if you would do such a search in the latin alphabet.

I’m still not sure that you have understood that you should not do this at all, except for things that you have mapped yourself, or are changing for other reasons, unless and until you have obtained permission from the Iranian OSM community in general.

Hi,

I’m almost sure that is right. I made my desired changes for my city, Mashhad, and now road names are heterogeneous completely. Besides, I discussed this issue with other Iranian mappers in a social network group. Almost everybody agreed. Do you really like that your city roads names be for example in English and numbers in Chinese?!!! :wink:

If there really is effective agreement in the Iranian OSM community, there is no problem. However, it came across that you wanted to do this on your own initiative, and you didn’t react to previous hints that you would need community agreement.

As one reason for not changing might be that the difficulties of entering new data in the correct format still exist, I think you also need to also take steps to make initial data entry easier.

I’d also note that you need to change ref ((e.g the M1 motorway in England is not name=M1, but rather ref=M1), addr:housenumber, and possibly postal code numbers, as well as name and name:fa. In the UK, at least, numbers rarely appear in road names, even though it is common in the USA, although they are normally spelled out, there (i.e. Fifth Avenue, not 5th Avenue. I actually wonder if many of these roads with numbers should really be ref=, or whether you are actually talking about ref=, not name=. This is a, random, example of the appropriate use of ref=, with a number, for a road in Iran, where you might want to convert it to the Arabic glyphs: https://www.openstreetmap.org/way/178143619.

On the other hand, here is an another random example, where it might have been inappropriate to mechanically convert any numerals (there aren’t any in this case): https://www.openstreetmap.org/way/196565437. In this case it might be appropriate to add a map note or fixme, requesting someone local to it to check whether it really was only signed in English, and if not, to relegate the existing name to name:en, and replace it with the name that actually appears on the local signs.

Doing the bulk edit should be fairly easy for someone with a computer programming background, and I would hope there are people with that background in the Iranian mapping community. I’d suggest, rather than doing it yourself, you should try and enlist their support. I imagine a JOSM plugin should be fairly easy for a programmer, but I haven’t looked into that in any detail. iD may be more difficult, as I doubt that it is designed to be customisable.

Thanks for your advice. It’s obvious that maybe some mistakes may occur, but I will do my best and check for errors, too. By the way, I want to convert only numbers in name tag, not any other tag (including Ref) which must be in English.

Now after your previous post, I have no difficulty with search & find in the name tag. I have difficulty with search & replace in the external editor. How can find numbers only in lines which have “name=” in there?

I think with Sed which stephan75 introduced I can solve my problem.

Several text editors support regular expressions in their search box, e.g. TextWrangler on OSX. I think that all but the simpliest editors support such functionality. No need to use sed, when you don’t want that