UNPKG

mobility-toolbox-js

Version:

Toolbox for JavaScript applications in the domains of mobility and logistics.

96 lines (95 loc) 3.73 kB
import { MapLibreLayer } from '@geoblocks/ol-maplibre-layer/lib'; import MaplibreLayerRenderer from '../renderers/MaplibreLayerRenderer'; import type { MapLibreLayerOptions, MapLibreOptions } from '@geoblocks/ol-maplibre-layer/lib/MapLibreLayer'; import type { QueryRenderedFeaturesOptions } from 'maplibre-gl'; import type { EventsKey } from 'ol/events'; import type Map from 'ol/Map'; import type { MobilityLayerOptions } from './Layer'; export type MaplibreLayerOptions = { apiKey?: string; apiKeyName?: string; mapLibreOptions?: MapLibreOptions; queryRenderedFeaturesOptions?: QueryRenderedFeaturesOptions | undefined; style?: maplibregl.StyleSpecification | null | string; url?: string; } & MobilityLayerOptions & Omit<MapLibreLayerOptions, 'mapLibreOptions'>; export declare let deprecated: (message: string) => void; /** * An OpenLayers layer able to display data from the [geOps Maps API](https://developer.geops.io/apis/maps). * * @example * import { MaplibreLayer } from 'mobility-toolbox-js/ol'; * * const layer = new MaplibreLayer({ * apiKey: 'yourApiKey', * // apiKeyName: 'key', * // mapLibreOptions: { * // interactive: false, * // trackResize: false, * // attributionControl: false, * // } * // queryRenderedFeaturesOptions: { * // layers: ['waters_lakes'], // map.getFeaturesAtPixel will only return lakes. * // }, * // style: 'travic_v2', * // url: 'https://maps.geops.io', * }); * * @classproperty {maplibregl.Map} mapLibreMap - The Maplibre map object. Readonly. * @classproperty {string} style - The [geOps Maps API](https://developer.geops.io/apis/maps) style. * * * @see <a href="/example/ol-maplibre-layer">OpenLayers Maplibre layer example</a> * * @extends {geoblocks/ol-maplibre-layer/MapLibreLayer} * @public */ declare class MaplibreLayer extends MapLibreLayer { olEventsKeys: EventsKey[]; set apiKey(newValue: string); get apiKey(): string; set apiKeyName(newValue: string); get apiKeyName(): string; /** * @deprecated Use layer.mapLibreMap. */ get maplibreMap(): maplibregl.Map | undefined; /** * @deprecated Use layer.mapLibreMap. */ get mbMap(): maplibregl.Map | undefined; get style(): string; set style(newValue: string); get url(): string; set url(newValue: string); /** * Constructor. * * @param {Object} options * @param {string} options.apiKey Accesss key for [geOps APIs](https://developer.geops.io/). * @param {string} [options.apiKeyName="key"] The [geOps Maps API](https://developer.geops.io/apis/maps) key name. * @param {maplibregl.MapOptions} [options.mapLibreOptions={ interactive: false, trackResize: false, attributionControl: false }] MapLibre map options. * @param {string} [options.style="travic_v2"] The [geOps Maps API](https://developer.geops.io/apis/maps) style. * @param {string} [options.url="https://maps.geops.io"] The [geOps Maps API](https://developer.geops.io/apis/maps) url. */ constructor(options: MaplibreLayerOptions); /** * Initialize the layer and listen to feature clicks. */ attachToMap(): void; /** * Create a copy of the MaplibreLayer. * * @param {Object} newOptions Options to override. See constructor. * @return {MaplibreLayer} A MaplibreLayer layer * @public */ clone(newOptions: MaplibreLayerOptions): MaplibreLayer; createRenderer(): MaplibreLayerRenderer; detachFromMap(): void; disposeInternal(): void; getStyle(): string | import("maplibre-gl").StyleSpecification; setMapInternal(map: Map): void; updateMaplibreMap(): void; } export default MaplibreLayer;