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

async function initializeWxSource() {
try {
const wxapi = new WxAPI({ dataServerURL: 'http://dataserver.com' });
const datasetName = 'gfs.global';
const variable = 'air.temperature.at-2m';
// Create a dataset manager
const wxDatasetManager = await wxapi.createDatasetManager(datasetName);
* // Create a layer source
const wxSource = new WxTileSource(
{ wxDatasetManager, variables },
{ id: 'wxsource', attribution: 'WxTiles' }
);

console.log('WxTileSource initialized:', wxSource);
} catch (error) {
console.error('Error initializing WxTileSource:', error);
}
}

initializeWxSource();

Hierarchy

Implements

  • CustomSourceInterface<any>

Constructors

Properties

attribution?: string

MAPBOX API

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

MAPBOX API

dataType: "raster" = ...

MAPBOX API required

maxzoom?: number

MAPBOX API

opacity?: number
tileSize: number = 256

MAPBOX API required. only 256

type: "custom" = ...

MAPBOX API required

Methods

  • Reloads the visible tiles with new data. Used for time/particles animation.

    Returns

    A promise that resolves when the tiles have been reloaded and redrawn.

    Parameters

    • Optional requestInit: WxRequestInit

      The request options.

    • redraw: boolean = true

    Returns Promise<void>

  • Returns an array of tile coordinates that cover the visible portion of the map. Note: MBOX API reassign this func in "map.addSource"

    Returns

    • An array of tile coordinates.

    Returns XYZ[]

  • Get comprehensive information about the current point on the map.

    Returns

    Parameters

    • lnglat: WxLngLat

      Coordinates of the point.

    • anymap: any

      map instance.

    Returns undefined | WxTileInfo

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

  • Removes a listener for the event.

    Returns

    Type Parameters

    • T extends "changed"

    Parameters

    • type: T

      The event name.

    • listener: ListenerMethod

      The listener function to remove.

    Returns void

  • add a listener for the event

    Returns

    Type Parameters

    • T extends "changed"

    Parameters

    • type: T

      event name

    • listener: ListenerMethod

      listener function

    Returns void

  • Internal

    Called when the layer is removed from the map.

    Returns

    Parameters

    • map: any

      The map instance.

    Returns void

  • Adds a listener for the event that will be executed only once. After the event is fired, the listener will be removed.

    Returns

    Type Parameters

    • T extends "changed"

    Parameters

    • type: T

      The event name.

    • listener: ListenerMethod

      The listener function to add.

    Returns void

  • Updates/reloads the source layer with new data. Note: MBOX API reassign this func in "map.addSource"

    Returns

    Returns void

Generated using TypeDoc