NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi All,

Is it possible to render place names (areas, river, streets, etc.) with two languages: place name in local language and its English translation near?

Thank you.

asked 24 Apr '13, 14:57

jvalcenko's gravatar image

jvalcenko
31112
accept rate: 0%

edited 30 Sep '13, 18:18

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


Yes. You can see the MapQuest rendering already does something like this: http://osm.org/go/0t2tSf--?layers=Q

For your own rendering, the best way to do this is likely in your PostgreSQL query. There you can add some logic to make sure all of the labels make sense, such as not including the English translation if it is the same as the local name. You'll need to make sure you have imported the name:en column as well as the local name. (If you are using osm2pgsql you will need to adjust your import style, or you can use hstore to import all tags, option -k (or --hstore), which obviates the need to change the default style.)

Here is an example query from an osm2pgsql import for a places layer. If there is a name:en tag for a place that is different from the name tag, the name will look like "Local Name (English Name)", otherwise you will just get "Local Name".

( select way,
    case when "name:en" is not null and "name:en" <> name
      then name || ' (' || "name:en" || ')'
      else name end as name
  from planet_osm_point
  where place in ('city', 'town', 'village', 'hamlet')
) as places

When using the hstore option replace "name:en" with tags->'name:en'.

A simple approach is to import into PostGIS using alternative table names, using the -p option, and then create views with the standard Mapnik stylesheet names. The easiest way to build the view is to query all the column names (select column_name from information_schema.columns where table_name ='TAB_NAME') and use this as the basis for creating the view. Only the name column needs to be changed as shown above. (An untested example is here on pastebin)

permanent link

answered 24 Apr '13, 15:25

ajashton's gravatar image

ajashton
17056
accept rate: 33%

edited 30 Sep '13, 10:53

SK53's gravatar image

SK53 ♦
28.1k48268433

Like in http://osm-tools.org -> thaimap ?

Ask the maintainer of that site: scroll down the page to see contact data. Or read his explanation how he did that.

Also see Map_internationalization in general.

permanent link

answered 26 Apr '13, 13:38

stephan75's gravatar image

stephan75
12.6k556210
accept rate: 6%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×440
×341
×8

question asked: 24 Apr '13, 14:57

question was seen: 9,209 times

last updated: 30 Sep '13, 18:18

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum