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 ->

Preference

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.

punjabi.png

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

https://github.com/GreatDevelopers/pbOSM

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.

http://punjabi.indiatyping.com/

https://www.google.co.in/search?client=ubuntu&channel=fs&q=english+punjabi+translator&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=GklaWefiEcXy8AeNnKrQDQ

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

Thank you

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s