Coder Social home page Coder Social logo

joycebabu / mapnik-german-l10n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from giggls/mapnik-german-l10n

0.0 2.0 0.0 195 KB

OSM map l10n functions

License: GNU Affero General Public License v3.0

Makefile 6.10% C 6.77% PLpgSQL 51.08% C++ 3.26% Shell 27.75% Python 5.04%

mapnik-german-l10n's Introduction

OSM map l10n functions

(from german mapnik style)

All l10n functions from german mapnik style are implemented as PL/pgSQL stored procedures and are therefore usable in a renderer independent way.

For this reason they are now hosted in their own repository.

Currently the code consists of three parts:

  1. An "Any-Latin" transliterate function using libicu
  2. A japanese kanji transliterate function using libkakasi
  3. A couple of PL/pgSQL functions which can be used to generate labels for map rendering.

See INSTALL.md file from sources for manual installation instructions. If you just installed the debian package all you have to do now ist to enable our extension in your PostgreSQL database as follows:

CREATE EXTENSION osml10n;

API

The following functions are provided for use in map rendering:

osml10n_get_placename_from_tags(tags hstore, loc_in_brackets boolean, show_brackets boolean DEFAULT false, separator text DEFAULT chr(10), targetlang text DEFAULT 'de', place geometry DEFAULT NULL, name text DEFAULT NULL) : Will try its best to return a usable name pair with both a localiced name and an on site name

osml10n_get_streetname_from_tags(tags hstore, loc_in_brackets boolean, show_brackets boolean DEFAULT false, separator text DEFAULT ' - ', targetlang text DEFAULT 'de', place geometry DEFAULT NULL, name text DEFAULT NULL) : Same as get_localized_placename_from_tags, but with some common abbreviations for street names (Straße->Str.), if name ist longer than 15 characters

osml10n_get_name_without_brackets_from_tags(tags hstore, loc_in_brackets boolean, targetlang text DEFAULT 'de', place geometry DEFAULT NULL, name text DEFAULT NULL) : Produces localiced name only output (on site name will be discarded)

osml10n_get_country_name(tags hstore, separator text DEFAULT chr(10), targetlang text DEFAULT 'de') : Generate a combined country name from name:xx tags (targetlang plus official languages of the country)

A convinient way of using these functions is to hide them behind virtual colums using database views.

Examples

select osml10n_get_placename_from_tags('"name"=>"Москва́","name:de"=>"Moskau","name:en"=>"Moscow"',true) as name;
       -->	Москва́
       -->	Moskau
select osml10n_get_placename_from_tags('"name"=>"Москва́","name:de"=>"Moskau","name:en"=>"Moscow"',false) as name;
       -->	Moskau
       -->	Москва́
select osml10n_get_placename_from_tags('"name"=>"القاهرة","name:de"=>"Kairo","int_name"=>"Cairo","name:en"=>"Cairo"',false) as name;
       -->	Kairo
       -->	القاهرة
select osml10n_get_placename_from_tags('name=>"Brixen Bressanone",name:de=>"Brixen",name:it=>"Bressanone"',false);
       -->	Brixen
       --> 	Bressanone
select osml10n_get_placename_from_tags('"name"=>"Roma","name:de"=>"Rom"',false) as name;
       -->	Rom
       -->	Roma
select osml10n_get_streetname_from_tags('"name"=>"Doktor-No-Straße"',false) as name;
       -->	Dr.-No-Str.
select osml10n_get_streetname_from_tags('"name"=>"Dr. No Street","name:de"=>"Professor-Doktor-No-Straße"',false) as name;
       -->	Prof.-Dr.-No-Str. - Dr. No St.
select osml10n_get_name_without_brackets_from_tags('"name"=>"Dr. No Street","name:de"=>"Doktor-No-Straße"') as name;
       -->	Doktor-No-Straße
select osml10n_get_streetname_from_tags('"name"=>"улица Воздвиженка","name:en"=>"Vozdvizhenka Street"',true,true,' ','de') as name;
       -->	ул. Воздвиженка (Vozdvizhenka St.)
select osml10n_get_streetname_from_tags('"name"=>"улица Воздвиженка"',true,true,' ','de') as name;
       -->	ул. Воздвиженка (ul. Vozdviženka)
select osml10n_get_streetname_from_tags('"name"=>"вулиця Молока"',true,false,' - ','de') as name;
       -->	вул. Молока - vul. Moloka
select osml10n_get_placename_from_tags('"name"=>"주촌  Juchon", "name:ko"=>"주촌","name:ko-Latn"=>"Juchon"',true) as name;
       -->	주촌
       -->	Juchon
select osml10n_get_placename_from_tags('"name"=>"주촌", "name:ko"=>"주촌","name:ko-Latn"=>"Juchon"',false) as name;
       -->	Juchon
       -->	J주촌
select osml10n_get_country_name('"ISO3166-1:alpha2"=>"IN","name:de"=>"Indien","name:hi"=>"भारत","name:en"=>"India"') as name;
       -->	Indien
       -->	भारत
       -->	India

mapnik-german-l10n's People

Contributors

giggls avatar chatelao avatar edward17 avatar woodpeck avatar das-g avatar eyusupov avatar max-dn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.