Class MapBoxProvider

Map box service tile provider. Map tiles can be fetched from style or from a map id.

API Reference

Hierarchy

Constructors

  • Parameters

    • apiToken: string = ''

      Map box api token.

    • id: string = ''

      Map style or map ID if the mode is set to MAP_ID.

    • mode: number = MapBoxProvider.STYLE

      Map tile access mode.

    • format: string = 'png'

      Image format.

    • useHDPI: boolean = false

      If true uses high DPI mode.

    • version: string = 'v4'

    Returns MapBoxProvider

Properties

apiToken: string

Server API access token.

bounds: number[] = []

Map bounds.

center: number[] = []

Map center point.

format: string

Map image tile format, the formats available are:

  • png True color PNG
  • png32 32 color indexed PNG
  • png64 64 color indexed PNG
  • png128 128 color indexed PNG
  • png256 256 color indexed PNG
  • jpg70 70% quality JPG
  • jpg80 80% quality JPG
  • jpg90 90% quality JPG
  • pngraw Raw png (no interpolation)
mapId: string

Map identifier composed of {username}.{style}

Some examples of the public mapbox identifiers:

  • mapbox.mapbox-streets-v7
  • mapbox.satellite
  • mapbox.mapbox-terrain-v2
  • mapbox.mapbox-traffic-v1
  • mapbox.terrain-rgb
maxZoom: number = 20

Maximum tile level.

minZoom: number = 0

Minimum tile level.

mode: number

Map tile access mode

  • MapBoxProvider.STYLE
  • MapBoxProvider.MAP_ID
name: string = ''

Name of the map provider

style: string

Map style to be used composed of {username}/{style_id}

Some example of the syles available:

  • mapbox/streets-v10
  • mapbox/outdoors-v10
  • mapbox/light-v9
  • mapbox/dark-v9
  • mapbox/satellite-v9
  • mapbox/satellite-streets-v10
  • mapbox/navigation-preview-day-v4
  • mapbox/navigation-preview-night-v4
  • mapbox/navigation-guidance-day-v4
  • mapbox/navigation-guidance-night-v4
useHDPI: boolean

Flag to indicate if should use high resolution tiles

version: string

Mapbox api version

  • mapbox/navigation-guidance-night-v4
ADDRESS: string = 'https://api.mapbox.com/'

Base adress of the mapbox service.

MAP_ID: number = 101

Access the map data using a map id.

STYLE: number = 100

Access the map data using a map style.

Methods

  • Get a tile for the x, y, zoom based on the provider configuration.

    The tile should be returned as a image object, compatible with canvas context 2D drawImage() and with webgl texImage2D() method.

    Returns

    Promise with the image obtained for the tile ready to use.

    Parameters

    • zoom: number

      Zoom level.

    • x: number

      Tile x.

    • y: number

      Tile y.

    Returns Promise<any>

Generated using TypeDoc