On this page

Type Alias MapOptions

MapOptions: Omit<MapOptions, "style" | "maplibreLogo" | "attributionControl"> & {
    apiKey?: string;
    attributionControl?: AttributionControlOptions;
    customAttribution?: string | string[];
    customControls?: boolean | string;
    forceNoAttributionControl?: boolean;
    fullscreenControl?: boolean | ControlPosition;
    geolocate?: typeof GeolocationType[keyof typeof GeolocationType] | boolean;
    geolocateControl?: boolean | ControlPosition;
    halo?: RadialGradientLayerConstructorOptions | boolean;
    language?: LanguageInfo | string;
    logSDKVersion?: boolean;
    maptilerLogo?: boolean;
    minimap?: boolean | ControlPosition | MinimapOptionsInput;
    navigationControl?: boolean | ControlPosition;
    projection?: ProjectionTypes;
    projectionControl?: boolean | ControlPosition;
    rtlTextPlugin?: boolean | string;
    scaleControl?: boolean | ControlPosition;
    space?: CubemapLayerConstructorOptions | boolean;
    style?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string;
    terrain?: boolean;
    terrainControl?: boolean | ControlPosition;
    terrainExaggeration?: number;
    useExperimentalTilePreloading?: boolean;
}

Options to provide to the Map constructor

Type Declaration

  • OptionalapiKey?: string

    Define the MapTiler Cloud API key to be used. This is strictly equivalent to setting config.apiKey and will overwrite it.

  • OptionalattributionControl?: AttributionControlOptions

    Options for an AttributionControl.

  • OptionalcustomAttribution?: string | string[]

    Attributions to show in addition to any other attributions in an AttributionControl.

  • OptionalcustomControls?: boolean | string

    Detect custom external controls. (default: false, will detect automatically if true)

  • OptionalforceNoAttributionControl?: boolean

    attributionControl

  • OptionalfullscreenControl?: boolean | ControlPosition

    Show the full screen control. (default: false, will show if true)

  • Optionalgeolocate?: typeof GeolocationType[keyof typeof GeolocationType] | boolean

    Method to position the map at a given geolocation. Only if:

    • hash is false
    • center is not provided

    If the value is true of "POINT" (given by GeolocationType.POINT) then the positionning uses the MapTiler Cloud Geolocation to find the non-GPS location point. The zoom level can be provided in the Map constructor with the zoom option or will be 13 if not provided.

    If the value is "COUNTRY" (given by GeolocationType.COUNTRY) then the map is centered around the bounding box of the country. In this case, the zoom option will be ignored.

    If the value is false, no geolocation is performed and the map centering and zooming depends on other options or on the built-in defaults.

    If this option is non-false and the options center is also provided, then center prevails.

    Default: false

  • OptionalgeolocateControl?: boolean | ControlPosition

    Show the geolocate control. (default: true, will hide if false)

  • Optionalhalo?: RadialGradientLayerConstructorOptions | boolean
  • Optionallanguage?: LanguageInfo | string

    Define the language of the map. This can be done directly with a language ISO code (eg. "en"), the ISO code prepended with the OSM flag (eg. "name:en" or even just "name"), or with a built-in shorthand (eg. Language.ENGLISH). Note that this is equivalent to setting the config.primaryLanguage and will overwrite it.

  • OptionallogSDKVersion?: boolean

    Whether to log the SDK version to the console. Default: Unless this is set explicitly to false, the SDK version will be logged to the console.

  • OptionalmaptilerLogo?: boolean

    Shows or hides the MapTiler logo in the bottom left corner (only for paid plans). Default is false for paid plans.

    For free plans the MapTiler logo is always visible, and cannot be disabled.

    mapTilerLogo: false // hides the logo
    
    mapTilerLogo: true // shows the logo
    
  • Optionalminimap?: boolean | ControlPosition | MinimapOptionsInput

    Display a minimap in a user defined corner of the map. (default: bottom-left corner) If set to true, the map will assume it is a minimap and forego the attribution control.

  • OptionalnavigationControl?: boolean | ControlPosition

    Show the navigation control. (default: true, will hide if false)

  • Optionalprojection?: ProjectionTypes

    Whether the projection should be "mercator" or "globe". If not provided, the style takes precedence. If provided, overwrite the style.

  • OptionalprojectionControl?: boolean | ControlPosition

    Show the projection control. (default: false, will show if true)

  • OptionalrtlTextPlugin?: boolean | string

    Whether to enable the RTL plugin or import a different one. Default is undefined, which means the plugin is enabled by default.

  • OptionalscaleControl?: boolean | ControlPosition

    Show the scale control. (default: false, will show if true)

  • Optionalspace?: CubemapLayerConstructorOptions | boolean

    Turn on/off spacebox.

    Default: { color: "#1D29F1" }

  • Optionalstyle?: ReferenceMapStyle | MapStyleVariant | StyleSpecification | string

    Style of the map. Can be:

    • a full style URL (possibly with API key)
    • a shorthand with only the MapTIler style name (eg. "streets-v2")
    • a longer form with the prefix "maptiler://" (eg. "maptiler://streets-v2")
  • Optionalterrain?: boolean

    Enables 3D terrain if true. (default: false)

  • OptionalterrainControl?: boolean | ControlPosition

    Show the terrain control. (default: false, will show if true)

  • OptionalterrainExaggeration?: number

    Exaggeration factor of the terrain. (default: 1, no exaggeration)

  • OptionaluseExperimentalTilePreloading?: boolean

    Whether to enable the experimental tile preloading feature. Default is false.

    API Key Usage: Each tile request counts against your MapTiler Cloud API key quota. Use with caution.

Was this helpful?
SDK JS
Reference
MapOptions