OpenTopoMap icon indicating copy to clipboard operation
OpenTopoMap copied to clipboard

Labels in English

Open comoglu opened this issue 7 years ago • 3 comments

Hi, Do we have a public opentopomap tile server with english labels for all countries? thanks in advance

comoglu avatar Sep 12 '18 22:09 comoglu

No, we just have local names worldwide. I am German and my own map is quite useless for me e.g. in Asia. Some day - perhaps - if we are fortune - we will provide transparent overlays showing custom labels. But don't expect it in the next 10 years, if no diligent coding-Jesus appears and joins the OTM team. :roll_eyes:

der-stefan avatar Sep 13 '18 16:09 der-stefan

This issue will be solved with vector maps - see #186.

der-stefan avatar Oct 15 '18 19:10 der-stefan

I'd like to add my 2 cents on this topic:

I'm fine with the local names as long as I can read them. As i am german I would prefer german 'München' over english 'Munich', in italy 'Roma' and 'Milano' are absolutely fine for me and I definitly expect 'Maribor' in Slovenia not called 'Marbug'. My problem starts when I look at China, Iran or China.

So for my perspective the main problem to face is the non-latin characterset used for many local names e.g. in asian and arabic countries. In this case "int_name" would be my first choice and "name:en" my second. "name" would be the fallback if none of the others exists

My solution for that is as follows:

  • add field 'country' in alle relevant osm tables (planet_osm_point, planet_osm_line, planet_osm_polygon, cities)
  • identify iso-code and relation-id for all countries using non-latin character sets (I did that by querying the capitals, list can be provided)
  • populate field 'country' with queries like: update planet_osm_point set country = 'GR' where osm_id in ( select p.osm_id from planet_osm_point p, planet_osm_polygon po where po.osm_id = -192307 and ST_WITHIN(p.way, po.way)); (all queries took approximately a day to complete, for russia and china I split the query and used districts for performance reasons)
  • add a field textlang (which can take values 'EN' for english and 'DEF' for default) in the respective queries in opentopomap.xml: (CASE WHEN country in ('TH','KH','AF','DZ','AM','BH','BD','BY','BT','BG','CN','CY','DARS','EG','ER','GE','GR','IQ','IR','IL','JP','YE','JO','KZ','QA','KG','XK','KW','LB','LY','MK','MR','MN','MM','NP','OM','PA','PS','RU','SA','RS','LK','SD','SY','TJ','TW','TN','UA','AE','TD','LA','KR','KP','MA','EH','ET','SO') THEN 'EN' ELSE 'DEF' END) as textlang (this probably could be done more elegant by introducing a country table and using a join)
  • also add a field "name:en": COALESCE("int_name", "name:en", name) as "name:en"
  • using 'textlang' as additional filter in the style files. I duplicated the Rules and added ([textlang] = 'EN') where the filter should show the name and ([textlang] = 'EN') where it should show "name:en". Actually I introduced the filter for 'DEF' in the existing file, then duplicated the style file adding a "-en" suffix and adapted it via search & replace.

Although the approach is quite straightforward it needs considerable effort. Another shortcoming is that values in the 'country' field are lost when data updated via osmosis changes an entry (osmosis deletes an existing and inserts a new data set). That means the script to update the data has to be repeated on a regular basis.

The result of the procedure described above can be seen on my OTM adaption at https://www.singletrails.com/maptest/maptest.html (may be down sometimes as server isn't in productive mode yet)

hottrails avatar Dec 02 '18 09:12 hottrails