Vector tiles from geolith builder 0.3.2 and later carry the name attributes that the Protomaps basemaps style reads. A style built with lang: 'en' then draws English labels, where tiles with only a local-script name drew Urdu or Chinese ones.
The planet tiles at api.geolith.app were built before this change. They carry these attributes after the next planet build. Build your own archive with builder 0.3.2 or later to have them today.
The attributes
| Attribute | Holds |
|---|---|
name | The name in the local script |
script | The script of name |
name2, script2 | A second name and its script, for a place named in two scripts |
name3, script3 | A third name and its script |
name:<lang>, for example name:en, name:hi | The name in that language, for each of the 41 languages of the Protomaps list |
The names come from OpenStreetMap name:*, Overture Maps names.common.<lang> and Natural Earth name_<lang>. A feature has a name:<lang> only where its sources have a name in that language. The attributes are the ones that the get_multiline_name and get_country_name expressions of @protomaps/basemaps read.
They are written for the places, pois, roads, water and earth layers, as the Protomaps profile does. The boundaries, landuse, transit and buildings layers keep a plain name. The pgf: attributes (pre-shaped Devanagari) are not written. The name:<lang> and script attributes add about 1% to tile size at zoom 12 and above, measured on a regional extract.
Use it in a style
import { layers, namedFlavor } from '@protomaps/basemaps';
const style = {
version: 8,
glyphs:
'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf',
sources: {
basemap: {
type: 'vector',
url: 'https://tiles.example.com/data/basemap.json',
},
},
layers: layers('basemap', namedFlavor('light'), { lang: 'en' }),
};
lang is one of the language codes of the Protomaps list. Serve the archive with the tile server library, or any PMTiles server.
Sources and licence
The code that writes the attributes is a port of the Protomaps basemaps names code (OsmNames, Script and ScriptSegmenter), which stays under its own licence. Third-party notices are in the NOTICE.md of each package; geolith notices prints them.