Tag: change language of osm

Playing with Languages in OSM

Hie Everyone.

As the title clearly explains the moto of the blog. So, let’s begin.

The logic which I have applied to display the name of the places in the OSM map is ->


Punjabi>Hindi>Original Name

Punjabi name is preferred first. If it null then Hindi will be preferred followed by original name.

The sample image is shown here.


The whole source code is the following link. You can clone it from here.


Now, without wasting much, I here repeat that particular code. It’s very easy. You can customize it in your own way.

Open the project.mml file. In sql queries replace the column name with the line

COALESCE(tags->’name:pa’,tags->’name:hi’,name) as name

Here coalesce function will display the first not null value. If all values are null then it will display no value.

Make sure you have installed the fonts of the corresponding language.

$sudo apt-get install fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont

The ttf files of all these fonts should be included in the fonts directory which your Mapnik is loading. In my case it is /usr/local/share/fonts/

You can translate English word to Punjabi from the following websites.



If you have any query related to it. Please do comment.

Thank you