A custom layer source implementation It is used to load and display weather data from the WxTiles server. NOTE Dont use this directly, use createSourceLayer instead

Example

const wxapi = new WxAPI({ 'http://dataserver.com' });

// Create a dataset manager (may be used for many layers from this dataset)
const datasetName = 'gfs.global';
const wxdatasetManager = await wxapi.createDatasetManager(datasetName);

// create a layer source
// Scalar example.For vector variables use either of the vector components (e.g. 'wind.eastward.at-10m')
const variable = 'air.temperature.at-2m';
const wxsource = wxdatasetManager.createSourceLayer({ variable }, { id: 'wxsource', attribution: 'WxTiles' }); //new WxTileSource(wxLayerOptions, mboxSourceOptions);

Hierarchy

Implements

Constructors

Properties

_needUpdateDSManager: boolean = false

A boolean flag indicating whether the dataset manager needs to be updated or not.

attribution?: string

MAPBOX API

bounds?: [number, number, number, number]

MAPBOX API

dataType: "raster" = 'raster'

MAPBOX API required

id: string

MAPBOX API required

maxzoom?: number

MAPBOX API

opacity?: number
tileSize: number = 256

MAPBOX API required. only 256

type: "custom" = 'custom'

MAPBOX API required

Accessors

Methods

  • Internal

    Loads a tile with the given coordinates and request options. Used by framework. Creates a representation of a tile for the framework. It rethrows 'AbortError' errors. It returns empty tile during datasetManager update or in case of any other error (e.g. network error, not found, etc.) It tries to update datasetManager if e.reason === 'instance-not-found' and update the layer

    Returns

    • A promise that resolves with the loaded tile.

    Parameters

    • coords: XYZ

      The tile coordinates to be loaded.

    • Optional requestInit: WxRequestInit

      The request options.

    Returns Promise<any>

  • Internal

    Called when the layer is removed from the map.

    Returns

    Parameters

    • map: any

      The map instance.

    Returns void

  • Set the style of the source by its name from default styles.

    Returns

    A promise that resolves when the style is set.

    Parameters

    • wxstyleName: string

      Name of the new style to set.

    • reload: boolean = true

      If true, the source will be reloaded and rerendered.

    Returns Promise<void>

Generated using TypeDoc