UNPKG

@maplibre/maplibre-gl-style-spec

Version:
1,221 lines 339 kB
//#region src/reference/latest.d.ts declare const _default: any; //#endregion //#region src/types.g.d.ts type ColorSpecification = string; type ProjectionDefinitionT = [string, string, number]; type ProjectionDefinitionSpecification = string | ProjectionDefinitionT | PropertyValueSpecification<ProjectionDefinitionT>; type PaddingSpecification = number | number[]; type NumberArraySpecification = number | number[]; type ColorArraySpecification = string | string[]; type VariableAnchorOffsetCollectionSpecification = Array<string | [number, number]>; type SpriteSpecification = string | { id: string; url: string; }[]; type FormattedSpecification = string; type ResolvedImageSpecification = string; type PromoteIdSpecification = { [_: string]: string; } | string; type ExpressionInputType = string | number | boolean; type VariableExpressionSpecification = ['var', string]; type CollatorExpressionSpecification = ['collator', { 'case-sensitive'?: boolean | ExpressionSpecification; 'diacritic-sensitive'?: boolean | ExpressionSpecification; locale?: string | ExpressionSpecification; }]; type InterpolationSpecification = ['linear'] | ['exponential', number] | ['cubic-bezier', number, number, number, number]; type ExpressionSpecification = ['array', ExpressionSpecification] | ['array', 'string' | 'number' | 'boolean', ExpressionSpecification] | ['array', 'string' | 'number' | 'boolean', number, ExpressionSpecification] | ['boolean', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | CollatorExpressionSpecification | ['format', ...(string | ['image', ExpressionSpecification] | ExpressionSpecification | { 'font-scale'?: number | ExpressionSpecification; 'text-font'?: ExpressionSpecification; 'text-color'?: ColorSpecification | ExpressionSpecification; 'vertical-align'?: 'bottom' | 'center' | 'top'; })[]] | ['image', string | ExpressionSpecification] | ['literal', unknown] | ['number', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | ['number-format', number | ExpressionSpecification, { 'locale'?: string | ExpressionSpecification; 'currency'?: string | ExpressionSpecification; 'min-fraction-digits'?: number | ExpressionSpecification; 'max-fraction-digits'?: number | ExpressionSpecification; }] | ['number-format', number | ExpressionSpecification, { 'locale'?: string | ExpressionSpecification; 'unit'?: string | ExpressionSpecification; 'min-fraction-digits'?: number | ExpressionSpecification; 'max-fraction-digits'?: number | ExpressionSpecification; }] | ['object', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | ['string', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | ['to-boolean', unknown | ExpressionSpecification] | ['to-color', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | ['to-number', unknown | ExpressionSpecification, ...(unknown | ExpressionSpecification)[]] | ['to-string', unknown | ExpressionSpecification] | ['typeof', unknown | ExpressionSpecification] | ['accumulated'] | ['feature-state', string | ExpressionSpecification] | ['geometry-type'] | ['id'] | ['line-progress'] | ['properties'] | ['at', number | ExpressionSpecification, ExpressionSpecification] | ['get', string | ExpressionSpecification, ExpressionSpecification?] | ['global-state', string] | ['has', string | ExpressionSpecification, ExpressionSpecification?] | ['in', null | ExpressionInputType | ExpressionSpecification, string | ExpressionSpecification] | ['index-of', null | ExpressionInputType | ExpressionSpecification, string | ExpressionSpecification, (number | ExpressionSpecification)?] | ['length', string | ExpressionSpecification] | ['slice', string | ExpressionSpecification, number | ExpressionSpecification, (number | ExpressionSpecification)?] | ['!', boolean | ExpressionSpecification] | ['!=', null | ExpressionInputType | ExpressionSpecification, null | ExpressionInputType | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['<', string | number | ExpressionSpecification, string | number | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['<=', string | number | ExpressionSpecification, string | number | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['==', null | ExpressionInputType | ExpressionSpecification, null | ExpressionInputType | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['>', string | number | ExpressionSpecification, string | number | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['>=', string | number | ExpressionSpecification, string | number | ExpressionSpecification, (CollatorExpressionSpecification | VariableExpressionSpecification)?] | ['all', ...(boolean | ExpressionSpecification)[]] | ['any', ...(boolean | ExpressionSpecification)[]] | ['case', boolean | ExpressionSpecification, null | ExpressionInputType | ExpressionSpecification, ...(boolean | null | ExpressionInputType | ExpressionSpecification)[], null | ExpressionInputType | ExpressionSpecification] | ['coalesce', ...(ExpressionInputType | ExpressionSpecification)[]] | ['match', string | number | ExpressionSpecification, string | number | string[] | number[], null | ExpressionInputType | ExpressionSpecification, ...(string | number | string[] | number[] | null | ExpressionInputType | ExpressionSpecification)[], // repeated as above null | ExpressionInputType | ExpressionSpecification] | ['within', GeoJSON.GeoJSON] | ['interpolate', InterpolationSpecification, number | ExpressionSpecification, ...(number | ColorSpecification | ExpressionSpecification | ProjectionDefinitionSpecification)[]] | ['interpolate-hcl', InterpolationSpecification, number | ExpressionSpecification, ...(number | ColorSpecification | ExpressionSpecification)[]] | ['interpolate-lab', InterpolationSpecification, number | ExpressionSpecification, ...(number | ColorSpecification | ExpressionSpecification)[]] | ['step', number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification, ...(number | ExpressionInputType | ExpressionSpecification)[]] | ['let', string, ExpressionInputType | ExpressionSpecification, ...(string | ExpressionInputType | ExpressionSpecification)[]] | VariableExpressionSpecification | ['concat', ...(ExpressionInputType | ExpressionSpecification)[]] | ['downcase', string | ExpressionSpecification] | ['is-supported-script', string | ExpressionSpecification] | ['join', string[] | ExpressionSpecification, string | ExpressionSpecification] | ['resolved-locale', CollatorExpressionSpecification] | ['split', string | ExpressionSpecification, string | ExpressionSpecification] | ['upcase', string | ExpressionSpecification] | ['rgb', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification] | ['rgba', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification] | ['to-rgba', ColorSpecification | ExpressionSpecification] | ['-', number | ExpressionSpecification, (number | ExpressionSpecification)?] | ['*', number | ExpressionSpecification, number | ExpressionSpecification, ...(number | ExpressionSpecification)[]] | ['/', number | ExpressionSpecification, number | ExpressionSpecification] | ['%', number | ExpressionSpecification, number | ExpressionSpecification] | ['^', number | ExpressionSpecification, number | ExpressionSpecification] | ['+', ...(number | ExpressionSpecification)[]] | ['abs', number | ExpressionSpecification] | ['acos', number | ExpressionSpecification] | ['asin', number | ExpressionSpecification] | ['atan', number | ExpressionSpecification] | ['ceil', number | ExpressionSpecification] | ['cos', number | ExpressionSpecification] | ['distance', GeoJSON.GeoJSON] | ['e'] | ['floor', number | ExpressionSpecification] | ['ln', number | ExpressionSpecification] | ['ln2'] | ['log10', number | ExpressionSpecification] | ['log2', number | ExpressionSpecification] | ['max', number | ExpressionSpecification, ...(number | ExpressionSpecification)[]] | ['min', number | ExpressionSpecification, ...(number | ExpressionSpecification)[]] | ['pi'] | ['round', number | ExpressionSpecification] | ['sin', number | ExpressionSpecification] | ['sqrt', number | ExpressionSpecification] | ['tan', number | ExpressionSpecification] | ['zoom'] | ['heatmap-density'] | ['elevation'] | ['global-state', string]; type ExpressionFilterSpecification = boolean | ExpressionSpecification; type LegacyFilterSpecification = ['has', string] | ['!has', string] | ['==', string, string | number | boolean] | ['!=', string, string | number | boolean] | ['>', string, string | number | boolean] | ['>=', string, string | number | boolean] | ['<', string, string | number | boolean] | ['<=', string, string | number | boolean] | ['in', string, ...(string | number | boolean)[]] | ['!in', string, ...(string | number | boolean)[]] | ['all', ...LegacyFilterSpecification[]] | ['any', ...LegacyFilterSpecification[]] | ['none', ...LegacyFilterSpecification[]]; type FilterSpecification = ExpressionFilterSpecification | LegacyFilterSpecification; type VisibilitySpecification = 'visible' | 'none' | ExpressionSpecification; type TransitionSpecification = { duration?: number; delay?: number; }; type CameraFunctionSpecification<T> = { type: 'exponential'; stops: Array<[number, T]>; } | { type: 'interval'; stops: Array<[number, T]>; }; type SourceFunctionSpecification<T> = { type: 'exponential'; stops: Array<[number, T]>; property: string; default?: T; } | { type: 'interval'; stops: Array<[number, T]>; property: string; default?: T; } | { type: 'categorical'; stops: Array<[string | number | boolean, T]>; property: string; default?: T; } | { type: 'identity'; property: string; default?: T; }; type CompositeFunctionSpecification<T> = { type: 'exponential'; stops: Array<[{ zoom: number; value: number; }, T]>; property: string; default?: T; } | { type: 'interval'; stops: Array<[{ zoom: number; value: number; }, T]>; property: string; default?: T; } | { type: 'categorical'; stops: Array<[{ zoom: number; value: string | number | boolean; }, T]>; property: string; default?: T; }; type PropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | ExpressionSpecification; type DataDrivenPropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | SourceFunctionSpecification<T> | CompositeFunctionSpecification<T> | ExpressionSpecification; type SchemaSpecification = { default?: unknown; }; type StateSpecification = Record<string, SchemaSpecification>; type MLFontFace = string | { url: string; "unicode-range"?: string[]; }; type FontFacesSpecification = Record<string, MLFontFace>; type StyleSpecification = { /** * Style specification version number. Must be 8. * * @example * ```json * 8 * ``` */ "version": 8; /** * A human-readable name for the style. * * @example * ```json * "Bright" * ``` */ "name"?: string; /** * Arbitrary properties useful to track with the stylesheet, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'maplibre:'. * * @example * ```json * { * "styleeditor:slimmode": true, * "styleeditor:comment": "Style generated 1677776383", * "styleeditor:version": "3.14.159265", * "example:object": { * "String": "one", * "Number": 2, * "Boolean": false * } * } * ``` */ "metadata"?: unknown; /** * Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * [-73.9749, 40.7736] * ``` */ "center"?: [number, number]; /** * Default map center altitude in meters above sea level. The style center altitude defines the altitude where the camera is looking at and will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * 123.4 * ``` */ "centerAltitude"?: number; /** * Default zoom level. The style zoom will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * 12.5 * ``` */ "zoom"?: number; /** * Default bearing, in degrees. The bearing is the compass direction that is "up"; for example, a bearing of 90° orients the map so that east is up. This value will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * 29 * ``` */ "bearing"?: number; /** * Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * 50 * ``` */ "pitch"?: number; /** * Default roll, in degrees. The roll angle is measured counterclockwise about the camera boresight. The style roll will be used only if the map has not been positioned by other means (e.g. map options or user interaction). * * @example * ```json * 45 * ``` */ "roll"?: number; /** * An object used to define default values when using the [`global-state`](https://maplibre.org/maplibre-style-spec/expressions/#global-state) expression. * * @default * ```json * {} * ``` * * @example * ```json * { * "chargerType": {"default": ["CCS", "CHAdeMO", "Type2"]}, * "minPreferredChargingSpeed": {"default": 50} * } * ``` */ "state"?: StateSpecification; /** * The global light source. * * @example * ```json * {"anchor": "viewport", "color": "white", "intensity": 0.4} * ``` */ "light"?: LightSpecification; /** * The map's sky configuration. **Note:** this definition is still experimental and is under development in maplibre-gl-js. * * @example * ```json * { * "sky-color": "#199EF3", * "sky-horizon-blend": 0.5, * "horizon-color": "#ffffff", * "horizon-fog-blend": 0.5, * "fog-color": "#0000ff", * "fog-ground-blend": 0.5, * "atmosphere-blend": [ * "interpolate", * ["linear"], * ["zoom"], * 0, * 1, * 10, * 1, * 12, * 0 * ] * } * ``` */ "sky"?: SkySpecification; /** * The projection configuration * * @example * ```json * { * "type": [ * "interpolate", * ["linear"], * ["zoom"], * 10, * "vertical-perspective", * 12, * "mercator" * ] * } * ``` */ "projection"?: ProjectionSpecification; /** * The terrain configuration. * * @example * ```json * {"source": "raster-dem-source", "exaggeration": 0.5} * ``` */ "terrain"?: TerrainSpecification; /** * Sources state which data the map should display. Specify the type of source with the `type` property. Adding a source isn't enough to make data appear on the map because sources don't contain styling details like color or width. Layers refer to a source and give it a visual representation. This makes it possible to style the same source in different ways, like differentiating between types of roads in a highways layer. * * Tiled sources (vector and raster) must specify their details according to the [TileJSON specification](https://github.com/mapbox/tilejson-spec). * * @example * ```json * { * "maplibre-demotiles": { * "type": "vector", * "url": "https://demotiles.maplibre.org/tiles/tiles.json" * }, * "maplibre-tilejson": { * "type": "vector", * "url": "http://api.example.com/tilejson.json" * }, * "maplibre-streets": { * "type": "vector", * "tiles": [ * "http://a.example.com/tiles/{z}/{x}/{y}.pbf", * "http://b.example.com/tiles/{z}/{x}/{y}.pbf" * ], * "maxzoom": 14 * }, * "wms-imagery": { * "type": "raster", * "tiles": [ * "http://a.example.com/wms?bbox={bbox-epsg-3857}&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857&width=256&height=256&layers=example" * ], * "tileSize": 256 * } * } * ``` */ "sources": { [_: string]: SourceSpecification; }; /** * An array of `{id: 'my-sprite', url: 'https://example.com/sprite'}` objects. Each object should represent a unique URL to load a sprite from and and a unique ID to use as a prefix when referencing images from that sprite (i.e. 'my-sprite:image'). All the URLs are internally extended to load both .json and .png files. If the `id` field is equal to 'default', the prefix is omitted (just 'image' instead of 'default:image'). All the IDs and URLs must be unique. For backwards compatibility, instead of an array, one can also provide a single string that represent a URL to load the sprite from. The images in this case won't be prefixed. * * @example * ```json * "https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite" * ``` */ "sprite"?: SpriteSpecification; /** * A URL template for loading signed-distance-field glyph sets in PBF format. * * If this property is set, any text in the `text-field` layout property is displayed in the font stack named by the `text-font` layout property based on glyphs located at the URL specified by this property. Otherwise, font faces will be determined by the `text-font` property based on the local environment. * * The URL must include: * * - `{fontstack}` - When requesting glyphs, this token is replaced with a comma separated list of fonts from a font stack specified in the `text-font` property of a symbol layer. * * - `{range}` - When requesting glyphs, this token is replaced with a range of 256 Unicode code points. For example, to load glyphs for the Unicode Basic Latin and Basic Latin-1 Supplement blocks, the range would be 0-255. The actual ranges that are loaded are determined at runtime based on what text needs to be displayed. * * The URL must be absolute, containing the [scheme, authority and path components](https://en.wikipedia.org/wiki/URL#Syntax). * * @example * ```json * "https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf" * ``` */ "glyphs"?: string; /** * The `font-faces` property can be used to specify what font files to use for rendering text. Font faces contain information needed to render complex texts such as [Devanagari](https://en.wikipedia.org/wiki/Devanagari), [Khmer](https://en.wikipedia.org/wiki/Khmer_script) among many others.<h2>Unicode range</h2>The optional `unicode-range` property can be used to only use a particular font file for characters within the specified unicode range(s). Its value should be an array of strings, each indicating a start and end of a unicode range, similar to the [CSS descriptor with the same name](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range). This allows specifying multiple non-consecutive unicode ranges. When not specified, the default value is `U+0-10FFFF`, meaning the font file will be used for all unicode characters. * * Refer to the [Unicode Character Code Charts](https://www.unicode.org/charts/) to see ranges for scripts supported by Unicode. To see what unicode code-points are available in a font, use a tool like [FontDrop](https://fontdrop.info/). * * <h2>Font Resolution</h2>For every name in a symbol layer’s [`text-font`](./layers.md/#text-font) array, characters are matched if they are covered one of the by the font files in the corresponding entry of the `font-faces` map. Any still-unmatched characters then fall back to the [`glyphs`](./glyphs.md) URL if provided. * * <h2>Supported Fonts</h2>What type of fonts are supported is implementation-defined. Unsupported fonts are ignored. * * @example * ```json * { * "Noto Sans Regular": [ * { * "url": "https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansKhmer/hinted/ttf/NotoSansKhmer-Regular.ttf", * "unicode-range": ["U+1780-17FF"] * }, * { * "url": "https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansDevanagari/hinted/ttf/NotoSansDevanagari-Regular.ttf", * "unicode-range": ["U+0900-097F"] * }, * { * "url": "https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansMyanmar/hinted/ttf/NotoSansMyanmar-Regular.ttf", * "unicode-range": ["U+1000-109F"] * }, * { * "url": "https://cdn.jsdelivr.net/gh/notofonts/notofonts.github.io/fonts/NotoSansEthiopic/hinted/ttf/NotoSansEthiopic-Regular.ttf", * "unicode-range": ["U+1200-137F"] * } * ], * "Unifont": "https://ftp.gnu.org/gnu/unifont/unifont-15.0.01/unifont-15.0.01.ttf" * } * ``` */ "font-faces"?: FontFacesSpecification; /** * A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's `transition` property. * * In addition to this global definition via `transition`, if any individual paint or layout property are marked as `Transitionable`, a corresponding `*-transition` property is avaliable to fine-tune the property’s animation between old and new values based on similar `duration` and `delay` values. * * For example, [`fill-color`](layers/#fill-color) is marked as `Transitionable`, so it can transition either independently via `fill-color-transition` or globally via the style's `transition` property: * * @example * ```json * {"duration": 300, "delay": 0} * ``` */ "transition"?: TransitionSpecification; /** * A style's `layers` property lists all the layers available in that style. The type of layer is specified by the `type` property, and must be one of `background`, `fill`, `line`, `symbol`, `raster`, `circle`, `fill-extrusion`, `heatmap`, `hillshade`, `color-relief`. * * Except for layers of the `background` type, each layer needs to refer to a source. Layers take the data that they get from a source, optionally filter features, and then define how those features are styled. * * @example * ```json * [ * { * "id": "coastline", * "source": "maplibre", * "source-layer": "countries", * "type": "line", * "paint": {"line-color": "#198EC8"} * } * ] * ``` */ "layers": Array<LayerSpecification>; }; type LightSpecification = { /** * Whether extruded geometries are lit relative to the map or viewport. * * @default * ```json * "viewport" * ``` * * @example * ```json * "map" * ``` */ "anchor"?: PropertyValueSpecification<"map" | "viewport">; /** * Position of the light source relative to lit (extruded) geometries, in `[r radial coordinate, a azimuthal angle, p polar angle]` where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below). * * @default * ```json * [1.15, 210, 30] * ``` * * @example * ```json * [1.5, 90, 80] * ``` */ "position"?: PropertyValueSpecification<[number, number, number]>; "position-transition"?: TransitionSpecification; /** * Color tint for lighting extruded geometries. * * @default * ```json * "#ffffff" * ``` */ "color"?: PropertyValueSpecification<ColorSpecification>; "color-transition"?: TransitionSpecification; /** * Intensity of lighting (on a scale from 0 to 1). Higher numbers will present as more extreme contrast. * * @default * ```json * 0.5 * ``` */ "intensity"?: PropertyValueSpecification<number>; "intensity-transition"?: TransitionSpecification; }; type SkySpecification = { /** * The base color for the sky. * * @default * ```json * "#88C6FC" * ``` */ "sky-color"?: PropertyValueSpecification<ColorSpecification>; "sky-color-transition"?: TransitionSpecification; /** * The base color at the horizon. * * @default * ```json * "#ffffff" * ``` */ "horizon-color"?: PropertyValueSpecification<ColorSpecification>; "horizon-color-transition"?: TransitionSpecification; /** * The base color for the fog. Requires 3D terrain. * * @default * ```json * "#ffffff" * ``` */ "fog-color"?: PropertyValueSpecification<ColorSpecification>; "fog-color-transition"?: TransitionSpecification; /** * How to blend the fog over the 3D terrain. Where 0 is the map center and 1 is the horizon. * * @default * ```json * 0.5 * ``` */ "fog-ground-blend"?: PropertyValueSpecification<number>; "fog-ground-blend-transition"?: TransitionSpecification; /** * How to blend the fog color and the horizon color. Where 0 is using the horizon color only and 1 is using the fog color only. * * @default * ```json * 0.8 * ``` */ "horizon-fog-blend"?: PropertyValueSpecification<number>; "horizon-fog-blend-transition"?: TransitionSpecification; /** * How to blend the sky color and the horizon color. Where 1 is blending the color at the middle of the sky and 0 is not blending at all and using the sky color only. * * @default * ```json * 0.8 * ``` */ "sky-horizon-blend"?: PropertyValueSpecification<number>; "sky-horizon-blend-transition"?: TransitionSpecification; /** * How to blend the atmosphere. Where 1 is visible atmosphere and 0 is hidden. It is best to interpolate this expression when using globe projection. * * @default * ```json * 0.8 * ``` */ "atmosphere-blend"?: PropertyValueSpecification<number>; "atmosphere-blend-transition"?: TransitionSpecification; }; type ProjectionSpecification = { /** * The projection definition type. Can be specified as a string, a transition state, or an expression. * * @default * ```json * "mercator" * ``` */ "type"?: PropertyValueSpecification<ProjectionDefinitionSpecification>; }; type TerrainSpecification = { /** * The source for the terrain data. */ "source": string; /** * The exaggeration of the terrain - how high it will look. * * @default * ```json * 1 * ``` */ "exaggeration"?: number; }; type VectorSourceSpecification = { /** * The type of the source. */ "type": "vector"; /** * A URL to a TileJSON resource. Supported protocols are `http:` and `https:`. */ "url"?: string; /** * An array of one or more tile source URLs, as in the TileJSON spec. */ "tiles"?: Array<string>; /** * An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre. * * @default * ```json * [-180, -85.051129, 180, 85.051129] * ``` */ "bounds"?: [number, number, number, number]; /** * Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. * * @default * ```json * "xyz" * ``` */ "scheme"?: "xyz" | "tms"; /** * Minimum zoom level for which tiles are available, as in the TileJSON spec. */ "minzoom"?: number; /** * Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels. * * @default * ```json * 22 * ``` */ "maxzoom"?: number; /** * Contains an attribution to be displayed when the map is shown to a user. */ "attribution"?: string; /** * A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`. If specified as a string for a vector tile source, the same property is used across all its source layers. */ "promoteId"?: PromoteIdSpecification; /** * A setting to determine whether a source's tiles are cached locally. */ "volatile"?: boolean; /** * The encoding used by this source. Mapbox Vector Tiles encoding is used by default. * * @default * ```json * "mvt" * ``` */ "encoding"?: "mvt" | "mlt"; }; type RasterSourceSpecification = { /** * The type of the source. */ "type": "raster"; /** * A URL to a TileJSON resource. Supported protocols are `http:` and `https:`. */ "url"?: string; /** * An array of one or more tile source URLs, as in the TileJSON spec. */ "tiles"?: Array<string>; /** * An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre. * * @default * ```json * [-180, -85.051129, 180, 85.051129] * ``` */ "bounds"?: [number, number, number, number]; /** * Minimum zoom level for which tiles are available, as in the TileJSON spec. */ "minzoom"?: number; /** * Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels. * * @default * ```json * 22 * ``` */ "maxzoom"?: number; /** * The minimum visual size to display tiles for this layer. Only configurable for raster layers. * * @default * ```json * 512 * ``` */ "tileSize"?: number; /** * Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. * * @default * ```json * "xyz" * ``` */ "scheme"?: "xyz" | "tms"; /** * Contains an attribution to be displayed when the map is shown to a user. */ "attribution"?: string; /** * A setting to determine whether a source's tiles are cached locally. */ "volatile"?: boolean; }; type RasterDEMSourceSpecification = { /** * The type of the source. */ "type": "raster-dem"; /** * A URL to a TileJSON resource. Supported protocols are `http:` and `https:`. */ "url"?: string; /** * An array of one or more tile source URLs, as in the TileJSON spec. */ "tiles"?: Array<string>; /** * An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by MapLibre. * * @default * ```json * [-180, -85.051129, 180, 85.051129] * ``` */ "bounds"?: [number, number, number, number]; /** * Minimum zoom level for which tiles are available, as in the TileJSON spec. */ "minzoom"?: number; /** * Maximum zoom level for which tiles are available, as in the TileJSON spec. Data from tiles at the maxzoom are used when displaying the map at higher zoom levels. * * @default * ```json * 22 * ``` */ "maxzoom"?: number; /** * The minimum visual size to display tiles for this layer. Only configurable for raster layers. * * @default * ```json * 512 * ``` */ "tileSize"?: number; /** * Contains an attribution to be displayed when the map is shown to a user. */ "attribution"?: string; /** * The encoding used by this source. Mapbox Terrain RGB is used by default. * * @default * ```json * "mapbox" * ``` */ "encoding"?: "terrarium" | "mapbox" | "custom"; /** * Value that will be multiplied by the red channel value when decoding. Only used on custom encodings. * * @default * ```json * 1 * ``` */ "redFactor"?: number; /** * Value that will be multiplied by the blue channel value when decoding. Only used on custom encodings. * * @default * ```json * 1 * ``` */ "blueFactor"?: number; /** * Value that will be multiplied by the green channel value when decoding. Only used on custom encodings. * * @default * ```json * 1 * ``` */ "greenFactor"?: number; /** * Value that will be added to the encoding mix when decoding. Only used on custom encodings. */ "baseShift"?: number; /** * A setting to determine whether a source's tiles are cached locally. */ "volatile"?: boolean; }; type GeoJSONSourceSpecification = { /** * The data type of the GeoJSON source. */ "type": "geojson"; /** * A URL to a GeoJSON file, or inline GeoJSON. */ "data": GeoJSON.GeoJSON | string; /** * Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels). * * @default * ```json * 18 * ``` */ "maxzoom"?: number; /** * Contains an attribution to be displayed when the map is shown to a user. */ "attribution"?: string; /** * Size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance. * * @default * ```json * 128 * ``` */ "buffer"?: number; /** * An expression for filtering features prior to processing them for rendering. */ "filter"?: FilterSpecification; /** * Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance). * * @default * ```json * 0.375 * ``` */ "tolerance"?: number; /** * If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new `Point` features in the source with additional properties: * * * `cluster` Is `true` if the point is a cluster * * * `cluster_id` A unique id for the cluster to be used in conjunction with the [cluster inspection methods](https://maplibre.org/maplibre-gl-js/docs/API/classes/GeoJSONSource/#getclusterexpansionzoom) * * * `point_count` Number of original points grouped into this cluster * * * `point_count_abbreviated` An abbreviated point count */ "cluster"?: boolean; /** * Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile. * * @default * ```json * 50 * ``` */ "clusterRadius"?: number; /** * Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15. */ "clusterMaxZoom"?: number; /** * Minimum number of points necessary to form a cluster if clustering is enabled. Defaults to `2`. */ "clusterMinPoints"?: number; /** * An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form `{"property_name": [operator, map_expression]}`. `operator` is any expression function that accepts at least 2 operands (e.g. `"+"` or `"max"`) - it accumulates the property value from clusters/points the cluster contains; `map_expression` produces the value of a single point. * * Example: `{"sum": ["+", ["get", "scalerank"]]}`. * * For more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `["accumulated"]` value, e.g.: * * `{"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}` */ "clusterProperties"?: unknown; /** * Whether to calculate line distance metrics. This is required for line layers that specify `line-gradient` values. */ "lineMetrics"?: boolean; /** * Whether to generate ids for the geojson features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values. */ "generateId"?: boolean; /** * A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`. */ "promoteId"?: PromoteIdSpecification; }; type VideoSourceSpecification = { /** * The data type of the video source. */ "type": "video"; /** * URLs to video content in order of preferred format. */ "urls": Array<string>; /** * Corners of video specified in longitude, latitude pairs. */ "coordinates": [[number, number], [number, number], [number, number], [number, number]]; }; type ImageSourceSpecification = { /** * The data type of the image source. */ "type": "image"; /** * URL that points to an image. */ "url": string; /** * Corners of image specified in longitude, latitude pairs. */ "coordinates": [[number, number], [number, number], [number, number], [number, number]]; }; type SourceSpecification = VectorSourceSpecification | RasterSourceSpecification | RasterDEMSourceSpecification | GeoJSONSourceSpecification | VideoSourceSpecification | ImageSourceSpecification; type FillLayerSpecification = { /** * Unique layer name. */ "id": string; "type": "fill"; /** * Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'maplibre:'. * * @example * ```json * {"source:comment": "Hydrology FCCODE 460 - Narrow wash"} * ``` */ "metadata"?: unknown; /** * Name of a source description to be used for this layer. Required for all layer types except `background`. */ "source": string; /** * Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources. */ "source-layer"?: string; /** * The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden. */ "minzoom"?: number; /** * The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden. */ "maxzoom"?: number; /** * A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `feature-state` expression is not supported in filter expressions. */ "filter"?: FilterSpecification; /** * Layout properties for the layer. */ "layout"?: { /** * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. */ "fill-sort-key"?: DataDrivenPropertyValueSpecification<number>; /** * Whether this layer is displayed. * * @default * ```json * "visible" * ``` */ "visibility"?: VisibilitySpecification; }; /** * Default paint properties for this layer. */ "paint"?: { /** * Whether or not the fill should be antialiased. * * @default * ```json * true * ``` */ "fill-antialias"?: PropertyValueSpecification<boolean>; /** * The opacity of the entire fill layer. In contrast to the `fill-color`, this value will also affect the 1px stroke around the fill, if the stroke is used. * * @default * ```json * 1 * ``` */ "fill-opacity"?: DataDrivenPropertyValueSpecification<number>; "fill-opacity-transition"?: TransitionSpecification; /** * Opacity applied to the layer as a whole. Unlike `fill-opacity` and alpha values in `fill-color`, which are applied per feature and accumulate where fills overlap, `fill-layer-opacity` is applied once so overlapping fills appear as a single surface at the given opacity. When both `fill-opacity` and `fill-layer-opacity` are set, the per-feature, overlap accumulation is preserved, then `fill-layer-opacity` composites the result. This property affects only the layer it is set on and cannot be used to composite multiple layers together or control how this layer blends with layers above or below it. * * ![fill-opacity vs. fill-layer-opacity](assets/fill-layer-opacity.svg) * * @default * ```json * 1 * ``` */ "fill-layer-opacity"?: PropertyValueSpecification<number>; "fill-layer-opacity-transition"?: TransitionSpecification; /** * The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used. When used with an SDF fill pattern, this serves as the foreground color of the pattern. * * @default * ```json * "#000000" * ``` */ "fill-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "fill-color-transition"?: TransitionSpecification; /** * The outline color of the fill. Matches the value of `fill-color` if unspecified. */ "fill-outline-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "fill-outline-color-transition"?: TransitionSpecification; /** * The geometry's offset. Values are `[x, y]` where negatives indicate left and up, respectively. * * @default * ```json * [0, 0] * ``` */ "fill-translate"?: PropertyValueSpecification<[number, number]>; "fill-translate-transition"?: TransitionSpecification; /** * Controls the frame of reference for `fill-translate`. * * @default * ```json * "map" * ``` */ "fill-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; /** * Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels. */ "fill-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>; "fill-pattern-transition"?: TransitionSpecification; }; }; type LineLayerSpecification = { /** * Unique layer name. */ "id": string; "type": "line"; /** * Arbitrary properties useful to track with the layer, but do not influence rendering. Properties should be prefixed to avoid collisions, like 'maplibre:'. * * @example * ```json * {"source:comment": "Hydrology FCCODE 460 - Narrow wash"} * ``` */ "metadata"?: unknown; /** * Name of a source description to be used for this layer. Required for all layer types except `background`. */ "source": string; /** * Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources. */ "source-layer"?: string; /** * The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden. */ "minzoom"?: number; /** * The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden. */ "maxzoom"?: number; /** * A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `feature-state` expression is not supported in filter expressions. */ "filter"?: FilterSpecification; /** * Layout properties for the layer. */ "layout"?: { /** * The display of line endings. * * @default * ```json * "butt" * ``` */ "line-cap"?: DataDrivenPropertyValueSpecification<"butt" | "round" | "square">; /** * The display of lines when joining. * * @default * ```json * "miter" * ``` */ "line-join"?: DataDrivenPropertyValueSpecification<"bevel" | "round" | "miter">; /** * Used to automatically convert miter joins to bevel joins for sharp angles. * * @default * ```json * 2 * ``` */ "line-miter-limit"?: DataDrivenPropertyValueSpecification<number>; /** * Used to automatically convert round joins to miter joins for shallow angles. * * @default * ```json * 1.05 * ``` */ "line-round-limit"?: DataDrivenPropertyValueSpecification<number>; /** * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. */ "line-sort-key"?: DataDrivenPropertyValueSpecification<number>; /** * Whether this layer is displayed. * * @default * ```json * "visible" * ``` */ "visibility"?: VisibilitySpecification; }; /** * Default paint properties for this layer. */ "paint"?: { /** * The opacity at which the line will be drawn. * * @default * ```json * 1 * ``` */ "line-opacity"?: DataDrivenPropertyValueSpecification<number>; "line-opacity-transition"?: TransitionSpecification; /** * Opacity applied to the layer as a whole. Unlike `line-opacity` and alpha values in `line-color`, which are applied per feature and accumulate where lines overlap, `line-layer-opacity` is applied once so overlapping lines appear as a single surface at the given opacity. When both `line-opacity` and `line-layer-opacity` are set, the per-feature, overlap accumulation is preserved, then layer-opacity composites the result. This property affects only the layer it is set on and cannot be used to composite multiple layers together or control how this layer blends with layers above or below it. * * ![line-opacity vs. line-layer-opacity](assets/line-layer-opacity.svg) * * @default * ```json * 1 * ``` */ "line-layer-opacity"?: PropertyValueSpecification<number>; "line-layer-opacity-transition"?: TransitionSpecification; /** * The color with which the line will be drawn. * * @default * ```json * "#000000" * ``` */ "line-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>; "line-color-transition"?: TransitionSpecification; /** * The geometry's offset. Values are `[x, y]` where negatives indicate left and up, respectively. * * @default * ```json * [0, 0] * ``` */ "line-translate"?: PropertyValueSpecification<[number, number]>; "line-translate-transition"?: TransitionSpecification; /** * Controls the frame of reference for `line-translate`. * * @default * ```json * "map" * ``` */ "line-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">; /** * Stroke thickness. * * @default * ```json * 1 * ``` */ "line-width"?: DataDrivenPropertyValueSpecification<number>; "line-width-transition"?: TransitionSpecification; /** * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. */ "line-gap-width"?: DataDrivenPropertyValueSpecification<number>; "line-gap-width-transition"?: TransitionSpecification; /** * The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset. */ "line-offset"?: DataDrivenPropertyValueSpecification<number>; "line-offset-transition"?: TransitionSpecification; /** * Blur applied to the line, in pixels. */ "line-blur"?: DataDrivenPropertyValueSpecification<number>; "line-blur-transition"?: TransitionSpecification; /** * Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Zoom-dependent expressions will be evaluated only at integer zoom levels. The only way to create an array value is using `["literal", [...]]`; arrays cannot be read from or derived from feature properties. */ "line-dasharray"?: DataDrivenPropertyValueSpecification<Array<number>>; "line-dasharray-transition"?: TransitionSpecification; /** * Name of image in sprite to use for