Interface StyleBuilderOptions

Options for configuring a style builder.

interface StyleBuilderOptions {
    baseUrl?: string;
    bounds?: [number, number, number, number];
    colors?: Partial<StyleBuilderColors>;
    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. Default: 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]. Default: [-180, -85.0511287798066, 180, 85.0511287798066]

colors?: Partial<StyleBuilderColors>

An object specifying overrides for default color values, keyed by the color names.

fonts?: Partial<StyleBuilderFonts>

An object specifying overrides for default font names, keyed by the font names.

glyphs?: string

The URL template for loading font glyphs, formatted with '{fontstack}' and '{range}' placeholders. Default: '/assets/glyphs/{fontstack}/{range}.pbf'

hideLabels?: boolean

If set to true, hides all map labels. Default: 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. Default: null

recolor?: RecolorOptions

Options for color adjustments and transformations applied to the entire style.

sprite?: SpriteSpecification

The URL for loading sprite images and metadata. Default: [{ id: 'basics', url: '/assets/sprites/basics/sprites' }]

tiles?: string[]

An array of URL templates for loading map tiles, using '{z}', '{x}', and '{y}' placeholders. Default: ['/tiles/osm/{z}/{x}/{y}']