Class MapStyleVariant
Index
Constructors
constructor
- new MapStyleVariant(
name: string,
variantType: string,
id: string,
referenceStyle: ReferenceMapStyle,
description: string,
imageURL: string,
deprecated?: boolean,
deprecationMessage?: string,
): MapStyleVariantParameters
- name: string
Human-friendly name
- variantType: string
Variant name the variant is addressed to from its reference style:
MapStyle.REFERNCE_STYLE_NAME.VARIANT_TYPE - id: string
MapTiler Cloud id
- referenceStyle: ReferenceMapStyle
Reference map style, used to retrieve sibling variants
- description: string
Human-friendly description
- imageURL: string
URL to an image describing the style variant
- deprecated: boolean = false
Whether this variant is deprecated or not
OptionaldeprecationMessage: stringMessage to display when the variant is deprecated
Returns MapStyleVariant
- name: string
Properties
deprecated
Whether this variant is deprecated or not
OptionaldeprecationMessage
Message to display when the variant is deprecated
Methods
getDescription
Get the human-friendly description
Returns string
getExpandedStyleURL
Get the style as usable by MapLibre, a string (URL) or a plain style description (StyleSpecification)
Returns string
getFullName
Returns string
getId
Get the MapTiler Cloud id
Returns string
getImageURL
Get the image URL that represent this variant
Returns string
getName
Get the human-friendly name
Returns string
getReferenceStyle
Get the reference style this variant belongs to
Returns ReferenceMapStyle
getType
Get the variant type (eg. "DEFAULT", "DARK", "PASTEL", etc.)
Returns string
getVariant
Retrieve the variant of a given type. If not found, will return the "DEFAULT" variant. (eg. this "DARK" variant does not have any "PASTEL" variant, then the "DEFAULT" is returned)
Parameters
- variantType: string
Returns MapStyleVariant
getVariants
Get all the variants for this variants, except this current one
Returns MapStyleVariant[]
hasVariant
Check if a variant of a given type exists for this variants (eg. if this is a "DARK", then we can check if there is a "LIGHT" variant of it)
Parameters
- variantType: string
Returns boolean
warnIfDeprecated
Parameters
- variant: MapStyleVariant = ...
Returns MapStyleVariant
An instance of MapStyleVariant contains information about a style to use that belong to a reference style