Search for content

Language Support (OSM)

Types of Languages

The PTV OSM vector format supports localized and native names for location labels (like countries or cities) and street elements, if available.

  • Native names represent the default language that is most common for the element in its native language. A town in Germany e.g. will have a native name in German.
  • Localized names are the translated variants for different languages of the native name. Also, some non-standard transliterated names are provided by this field, see the next chapter for more details.

Example Tile Data

A typical entry in the tile data for the town name property looks like this (the binary tile data was converted to json to make it readable):

"properties": {
        "name": "České Budějovice",
        "name_da": "Ceske Budejovice",
        "name_nl": "Ceske Budejovice",
        "name_en": "Budweis",
        "name_fi": "Ceske Budejovice",
        "name_fr": "Ceske Budejovice",
        "name_de": "Budweis",
        "name_el": "Τσέσκε Μπουντεγιόβιτσε",
        "name_el_latn": "Tseske Bountegiovitse",
        "name_hu": "Ceske Budejovice",
        "name_hu_latn": "Ceske Budejovice",
        "name_it": "Ceske Budejovice",
        "name_no": "Ceske Budejovice",
        "name_pl": "Czeskie Budziejowice",
        "name_pl_latn": "Czeskie Budziejowice",
        "name_pt": "Ceske Budejovice",
        "name_ru": "Ческе-Будеёвице",
        "name_ru_latn": "Cheske-Budeyovitse",
        "name_sk": "České Budejovice",
        "name_sk_latn": "Ceske Budejovice",
        "name_es": "Ceske Budejovice",
        "name_sv": "Ceske Budejovice",
}
  • The name field holds the native name (in this case in Czech language). This corresponds to the default language of the element.
  • The localized names are identified through the name tag plus an underscore followed by a BCP 47 language tag, e.g. `name_en` for english.

In the map styles only the native name is set. Switching the language must be done manually and will be described later.

Style Labels and Field Names

List of all used name tags and their corresponding style element: 

Style label nameField nameLocalized names supported
LBL_Country_BignameX
LBL_Country_MediumnameX
LBL_Country_SmallnameX
LBL_StatenameX
LBL_CityMajorCapitalnameX
LBL_CityMajorVeryLargenameX
LBL_CityMajorLargenameX
LBL_CityMinorLargenameX
LBL_CityMajorVillagenameX
LBL_CityMinorVillagenameX
LBL_RoadnameX
LBL_WaternameX
LBL_Water_LinearnameX
LBL_WoodlandAreanameX
LBL_Park_StatenameX
LBL_BuiltupAreaname X

Not all elements contain a localized name. Please note that localized names are optional for the styles that support them.

Supported Languages

If available we deliver a list of language alternatives for the native field name:

IETF BCP 47 language tagLanguage
bsBosnian
bs-latnBosnian, transliterated
bgBulgarian
bgBulgarian, transliterated
zhChinese
csCzech
cs-latnCzech, transliterated
daDanish
nlDutch
enEnglish
etEstonian
et-latnEstonian, transliterated
fiFinnish
frFrench
deGerman
gaIrish
elGreek, modern
el-latnGreek, modern, transliterated
hiHindi
hi-latnHindi, transliterated
huHungarian
hu-latnHungarian, transliterated
idIndonesian
itItalian
jaJapanese
koKorean
ko-latnKorean, transliterated
lvLatvian
lv-latnLatvian, transliterated
ltLithuanian
lt-latnLithuanian, transliterated
noNorwegian
ptPortuguese
plPolish
pl-latnPolish, transliterated
esSpanish, Castilian
roRomanian
ro-latnRomanian, transliterated
ruRussian
ru-latnRussian, transliterated
hrCroatian
hr-latnCroatian, transliterated
skSlovak
sk-latnSlovak, transliterated
slSlovenian
sl-latnSlovenian, transliterated
srSerbian
sr-latnSerbian, transliterated
svSwedish
trTurkish
tr-latnTurkish, transliterated
ukUkrainian
uk-laznUkrainian, transliterated
urUrdu
viVietnamese
thThai

Switching Languages in MapLibreGL.js

All styles use the native name as default. Switching the native language to another language can be achieved by using the setLayoutProperty() of MapLibre. The following example uses plain javascript and MapLibre expressions.

 

Example  - Switching the name of the style element LBL_City to english (with fallback to the native name)

map.setLayoutProperty('LBL_CityMajorCapital', 'text-field', ['coalesce',['get','name_en'],['get', 'name']]);

 

['coalesce',['get','name_en'],['get', 'name']] is a MapLibre expression. The ['coalesce',...] statement returns the first element in the parameter list that is not null. So the statement ['get','name_en'] tries to retrieve the name_eng property for an element from the tile. If this property is null, coalesce will return the value of ['get', 'name'] as the native language fallback.