Class MapStyleVariant

An instance of MapStyleVariant contains information about a style to use that belong to a reference style

Index

Constructors

  • Parameters

    • 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: string

      Message to display when the variant is deprecated

    Returns MapStyleVariant

Properties

deprecated: boolean = false

Whether this variant is deprecated or not

deprecationMessage?: string

Message to display when the variant is deprecated

Methods

  • Get the human-friendly description

    Returns string

  • Get the style as usable by MapLibre, a string (URL) or a plain style description (StyleSpecification)

    Returns string

  • Get the MapTiler Cloud id

    Returns string

  • Get the image URL that represent this variant

    Returns string

  • Get the human-friendly name

    Returns string

  • Get the variant type (eg. "DEFAULT", "DARK", "PASTEL", etc.)

    Returns string

  • 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

  • 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

Was this helpful?

Client JS
Reference
MapStyleVariant