Skip to main content

ChartRegistry

Constructors

Constructor

new ChartRegistry(map, showBasemap?, options?): ChartRegistry

Parameters

map

Map$1

Maplibre map instance

showBasemap?

boolean = false

Show or hide default basemap

options?

ChartOptions

Options to control chart presentation

Returns

ChartRegistry

Methods

addChart()

addChart(chartId): Promise<void>

Adds the specified chart to the map if it has not already been added

Parameters

chartId

string

ID of the chart to be added

Returns

Promise<void>


getChartIds()

getChartIds(): string[]

Returns the ordered IDs of all loaded charts

Returns

string[]

Array of chart IDs


getInfoAtLngLat()

getInfoAtLngLat(coords, snapPixels?): QueryResult

Retrieves chart and feature information at the specified coordinates

Parameters

coords

LngLat

Maplibre LngLat coordinate to query

snapPixels?

number = 10

Pixel buffer around the point used for hit detection

Returns

QueryResult

see QueryResult containing matching chart features


getInfoAtPoint()

getInfoAtPoint(point, snapPixels?): QueryResult

Retrieves chart and feature information at the specified map point

Parameters

point

Point

MapLibre point to query

snapPixels?

number = 10

Pixel buffer around the point used for hit detection

Returns

QueryResult

see QueryResult containing matching chart features


hideBasemap()

hideBasemap(): void

Hide the default world basemap

Returns

void


hideChart()

hideChart(chartId): void

Hides the specified chart by making its layers hidden

Parameters

chartId

string

ID of the chart to hide

Returns

void


hideLayer()

hideLayer(layerName, chartId?): void

Hides the specified layer by making it hidden

When a chart ID is provided, the visibility change is applied only to the layer belonging to that chart

Parameters

layerName

string

Name of the layer to hide

chartId?

string

Optional chart ID to scope the change

Returns

void


load()

Call Signature

load(chartxInfoUrl): Promise<void>

Auto load ENC charts and other assets from chartx-server

Parameters
chartxInfoUrl

string

Returns

Promise<void>

Call Signature

load(chartxInfo): Promise<void>

Auto load ENC charts and other assets from chartx-server

Parameters
chartxInfo

ChartxUrls

Returns

Promise<void>


loadChart()

loadChart(chartId, tileJsonUrl, dsidUrl): Promise<void>

Load a single ENC chart and add it to the map

Parameters

chartId

string

Unique ID or name of the chart

tileJsonUrl

string

chartx-server TileJSON endpoint for the chart

dsidUrl

string

chartx-server DSID endpoint for the chart

Returns

Promise<void>


loadCharts()

loadCharts(chartsUrl): Promise<void>

Loads and renders all ENC charts available from the chartx-server

Charts are automatically ordered by their compilation scale to ensure correct display priority

Parameters

chartsUrl

string

chartx-server endpoint for retrieving available ENC charts

Returns

Promise<void>


loadSprites()

loadSprites(spriteUrl): Promise<void>

Load the required sprite sheets for IHO presentation symbols

Parameters

spriteUrl

string

URL of the chartx-server sprite endpoint

Returns

Promise<void>


onChartClick()

onChartClick(callback): ChartClickSubscription

Registers a callback to be invoked when a chart feature is clicked

The callback is called with a QueryResult containing information about the selected chart feature

Parameters

callback

(info) => void

Function invoked on chart click

Returns

ChartClickSubscription

A a subscription object with unsubscribe handle to remove the onChartClick listener


removeChart()

removeChart(chartId): Promise<void>

Removes the specified chart from the map if available

Parameters

chartId

string

ID of the chart to be removed

Returns

Promise<void>


setOptions()

setOptions(options): Promise<void>

Sets the chart options to control symbology

Parameters

options

ChartOptions

see ChartOptions

Returns

Promise<void>


showBasemap()

showBasemap(): void

Show the default world basemap

Returns

void


showChart()

showChart(chartId): void

Shows the specified chart by making its layers visible

Parameters

chartId

string

ID of the chart to show

Returns

void


showLayer()

showLayer(layerName, chartId?): void

Shows the specified layer by making it visible

When a chart ID is provided, the visibility change is applied only to the layer belonging to that chart

Parameters

layerName

string

Name of the layer to show

chartId?

string

Optional chart ID to scope the change

Returns

void