Interface StyleBuilderOptions

Options for configuring the style builder.

interface StyleBuilderOptions {
    baseUrl?: string;
    bounds?: [number, number, number, number];
    colors?: Partial<StyleBuilderColors<string | Color>>;
    fonts?: Partial<StyleBuilderFonts>;
    glyphs?: string;
    hideLabels?: boolean;
    language?: Language;
    recolor?: RecolorOptions;
    sprite?: SpriteSpecification;
    tiles?: string[];
}

Properties

baseUrl?: string

The base URL for loading external resources like tiles, sprites, and fonts.

document.location.origin (in the browser), or 'https://tiles.versatiles.org'
bounds?: [number, number, number, number]

The bounding box for the map, formatted as [sw.lng, sw.lat, ne.lng, ne.lat].

[-180, -85.0511287798066, 180, 85.0511287798066]
colors?: Partial<StyleBuilderColors<string | Color>>

An object specifying overrides for default color values, keyed by the color names. See also: StyleBuilderColors

fonts?: Partial<StyleBuilderFonts>

An object specifying overrides for default font names, keyed by the font names. See also: StyleBuilderFonts

glyphs?: string

The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders.

'/assets/glyphs/{fontstack}/{range}.pbf'
hideLabels?: boolean

If set to true, hides all map labels.

false
language?: Language

Set the language ('en', 'de') of all map labels. A null value means that the language of the country in which the label is drawn will be used. See also: Language

null
recolor?: RecolorOptions

Options for color adjustments and transformations applied to the entire style. See also: RecolorOptions

The URL for loading sprite images and metadata.

[{ id: 'basics', url: '/assets/sprites/basics/sprites' }]
tiles?: string[]

An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders.

['/tiles/osm/{z}/{x}/{y}']