Customizing OSM Language

While searching on how to customize the language of the osm map. I got to know very interesting points about it.

These points are listed here.

  1. For handling common software tasks such as memory management, file system access, regular expressions, and XML parsing, Mapnik utilizes the Boost C++ libraries.
  2. osm2pgsql is a utility, that converts OpenStreetMap data into a format that can be loaded into PostgreSQL.
  3. For data transfer, several database dumps are created, which are available for download. The complete dump is called planet.osm. These dumps exist in two formats, one using XML and one using the Protocol Buffer Binary Format (PBF).
  4. $sudo -u amisha renderd -f -c /usr/local/etc/renderd.conf

In the above command “renderd -f” starts deamon in foreground mode, good for troubleshooting.

Now, coming to the main point i.e. how to customize the language of map. Frankly speaking, I havn’t done it yet completely, but in a process to do it.

I am following the link to do the same as suggested by my senior “Vigasdeep”. It’s link to the github repo.

STEPS

  1. Clone it.
  2. Install the following packages.
sudo apt-get install libicu-dev libkakasi2-dev postgresql-server-dev-9.3 build-essential debhelper pandoc

Then I installed the library “libutf8proc-dev” through the command

$sudo apt-get install libutf8proc-dev

Unfortunately, I got an error.utf

Then my senior “Amarjeet” helped me to solve the issue. I installed it from source https://github.com/tkelman/libutf8proc

Clone the repo to the home directory and then run the commands

$sudo make && sudo make install

Upto this we have installed all the packages.

  1. Then run the command in the repo “mapnik-german-l10n”

$sudo make && sudo make install

  1. The build process will need to download country_osm_grid.sql from https://github.com/twain47/Nominatim/raw/master/data/country_osm_grid.sql and put it inside your build directory.

  2. Load the required extensions into your database

CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
CREATE EXTENSION unaccent;
CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION osml10n;

While creating the last extension I got an error

gis=# CREATE EXTENSION osml10n;
ERROR:  could not load library “/usr/lib/postgresql/9.3/lib/osml10n_kanjitranscript.so”: libutf8proc.so.1: cannot open shared object file: No such file or directory

Actually the database server was not able to find the “libutf8proc.so.1” file there. I was having the same file under the path /usr/local/lib/libutf8proc.so.1. So I copy pasted it.

But still the error is not solved.

Then I got to know that the file should have permissions 644 but I have given it 777. After resolving it I was able to create the extension.

  1. Afterwards I will able to do the following:
gis=# select osml10n_translit('北京');
 osml10n_translit
---------------
 běi jīng
 (1 row)
gis=# select osml10n_kanji_transcript('漢字');
 osml10n_kanji_transcript
---------------------
 kanji
 (1 row)

gis=# select osml10n_translit('भारत');
osml10n_translit
---------------------
bhārata
 (1 row)

The next procedure I will publish in my next blog.

So till then, have  a good time.

 

 

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