esri-gl 0.9.0-alpha.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,19 +2,10 @@
2
2
 
3
3
  A TypeScript library that bridges Esri ArcGIS REST services with MapLibre GL JS and Mapbox GL JS. It replicates Esri Leaflet's architecture patterns while being compatible with modern WebGL mapping libraries.
4
4
 
5
- > **🚧 Development Notice**
6
- >
7
- > This project is currently under active development. APIs may change between releases and some features may not be fully stable. Please use with caution in production environments and check the [changelog](CHANGES.md) for breaking changes between versions.
8
-
9
5
  [![npm version](https://badge.fury.io/js/esri-gl.svg)](https://badge.fury.io/js/esri-gl)
10
6
  [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
11
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
8
 
13
- ## 🔗 Links
14
-
15
- - **📚 [Documentation](https://esri-gl.netlify.app/)** - Complete API reference and guides
16
- - **🎮 [Live Demos](https://esri-gl-demo.netlify.app/)** - Interactive examples and code samples
17
-
18
9
  **Note**: This library is compatible with both **MapLibre GL JS** and **Mapbox GL JS**.
19
10
 
20
11
  ## Features
@@ -0,0 +1,30 @@
1
+ import { Layer, type LayerOptions } from './Layer';
2
+ export interface BasemapLayerOptions extends LayerOptions {
3
+ key?: string;
4
+ apikey?: string;
5
+ token?: string;
6
+ language?: string;
7
+ worldview?: string;
8
+ style?: string;
9
+ }
10
+ /**
11
+ * BasemapLayer for MapLibre GL JS - equivalent to Esri Leaflet's BasemapLayer
12
+ * Provides access to Esri's basemap services as vector tile layers
13
+ */
14
+ export declare class BasemapLayer extends Layer {
15
+ private static readonly BASEMAPS;
16
+ private config;
17
+ constructor(key: string | BasemapLayerOptions, options?: BasemapLayerOptions);
18
+ protected _createSource(): void;
19
+ protected _createLayer(): void;
20
+ /**
21
+ * Set the basemap key
22
+ */
23
+ setBasemap(key: string): BasemapLayer;
24
+ /**
25
+ * Get available basemap keys
26
+ */
27
+ static getAvailableBasemaps(): string[];
28
+ }
29
+ export declare function basemapLayer(key: string | BasemapLayerOptions, options?: BasemapLayerOptions): BasemapLayer;
30
+ export default basemapLayer;
@@ -0,0 +1,75 @@
1
+ import { RasterLayer, RasterLayerOptions } from './RasterLayer';
2
+ import { MapService } from '../Services/MapService';
3
+ export interface DynamicMapLayerOptions extends RasterLayerOptions {
4
+ url: string;
5
+ layers?: number[] | false;
6
+ layerDefs?: Record<string, string> | false;
7
+ timeOptions?: Record<string, unknown> | false;
8
+ dynamicLayers?: unknown[] | false;
9
+ }
10
+ /**
11
+ * DynamicMapLayer - Displays ArcGIS Server Map Services as raster layers
12
+ * Equivalent to Esri Leaflet's DynamicMapLayer but adapted for MapLibre GL JS
13
+ */
14
+ export declare class DynamicMapLayer extends RasterLayer {
15
+ protected service: MapService;
16
+ constructor(options: DynamicMapLayerOptions);
17
+ /**
18
+ * Get dynamic layers
19
+ */
20
+ getDynamicLayers(): unknown[] | false;
21
+ /**
22
+ * Set dynamic layers
23
+ */
24
+ setDynamicLayers(dynamicLayers: unknown[]): DynamicMapLayer;
25
+ /**
26
+ * Get layers
27
+ */
28
+ getLayers(): number[] | false;
29
+ /**
30
+ * Set layers
31
+ */
32
+ setLayers(layers: number[] | false): DynamicMapLayer;
33
+ /**
34
+ * Get layer definitions
35
+ */
36
+ getLayerDefs(): Record<string, string> | false;
37
+ /**
38
+ * Set layer definitions
39
+ */
40
+ setLayerDefs(layerDefs: Record<string, string> | false): DynamicMapLayer;
41
+ /**
42
+ * Get time options
43
+ */
44
+ getTimeOptions(): Record<string, unknown> | false;
45
+ /**
46
+ * Set time options
47
+ */
48
+ setTimeOptions(timeOptions: Record<string, unknown> | false): DynamicMapLayer;
49
+ /**
50
+ * Create a query task
51
+ */
52
+ query(): import("../main").Query;
53
+ /**
54
+ * Create an identify task
55
+ */
56
+ identify(): import("../main").IdentifyFeatures;
57
+ /**
58
+ * Create a find task
59
+ */
60
+ find(): import("../main").Find;
61
+ /**
62
+ * Build export parameters for the service
63
+ */
64
+ protected _buildExportParams(): Record<string, unknown>;
65
+ /**
66
+ * Request export from the service
67
+ */
68
+ protected _requestExport(params: Record<string, unknown>, bounds: [number, number, number, number]): Promise<void>;
69
+ /**
70
+ * Update the layer
71
+ */
72
+ protected _update(): void;
73
+ }
74
+ export declare function dynamicMapLayer(options: DynamicMapLayerOptions): DynamicMapLayer;
75
+ export default dynamicMapLayer;
@@ -0,0 +1,67 @@
1
+ import type { Map } from '@/types';
2
+ export interface LayerOptions {
3
+ url?: string;
4
+ opacity?: number;
5
+ attribution?: string;
6
+ interactive?: boolean;
7
+ zIndex?: number;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Base Layer class for MapLibre GL JS layers
12
+ * Similar to Esri Leaflet's layer functionality but adapted for MapLibre
13
+ *
14
+ * This is equivalent to Leaflet's Layer class but for MapLibre GL JS
15
+ */
16
+ export declare class Layer {
17
+ options: LayerOptions;
18
+ protected _map?: Map;
19
+ protected _sourceId: string;
20
+ protected _layerId: string;
21
+ constructor(options?: LayerOptions);
22
+ /**
23
+ * Add layer to map
24
+ */
25
+ addTo(map: Map): Layer;
26
+ /**
27
+ * Remove layer from map
28
+ */
29
+ remove(): Layer;
30
+ /**
31
+ * Set layer opacity
32
+ */
33
+ setOpacity(opacity: number): Layer;
34
+ /**
35
+ * Get layer opacity
36
+ */
37
+ getOpacity(): number;
38
+ /**
39
+ * Set layer z-index
40
+ */
41
+ setZIndex(zIndex: number): Layer;
42
+ /**
43
+ * Get the source ID
44
+ */
45
+ getSourceId(): string;
46
+ /**
47
+ * Get the layer ID
48
+ */
49
+ getLayerId(): string;
50
+ /**
51
+ * Get attribution text
52
+ */
53
+ getAttribution(): string | undefined;
54
+ /**
55
+ * Create the source - to be implemented by subclasses
56
+ */
57
+ protected _createSource(): void;
58
+ /**
59
+ * Create the layer - to be implemented by subclasses
60
+ */
61
+ protected _createLayer(): void;
62
+ /**
63
+ * Update the source - to be implemented by subclasses
64
+ */
65
+ protected _updateSource(): void;
66
+ }
67
+ export default Layer;
@@ -0,0 +1,71 @@
1
+ import { Layer, type LayerOptions } from './Layer';
2
+ import { Service } from '../Services/Service';
3
+ export interface RasterLayerOptions extends LayerOptions {
4
+ service?: Service;
5
+ updateInterval?: number;
6
+ format?: string;
7
+ transparent?: boolean;
8
+ f?: string;
9
+ useCors?: boolean;
10
+ from?: Date;
11
+ to?: Date;
12
+ }
13
+ /**
14
+ * RasterLayer - Base class for raster-based layers like DynamicMapLayer and ImageMapLayer
15
+ * Equivalent to Esri Leaflet's RasterLayer but adapted for MapLibre GL JS
16
+ */
17
+ export declare class RasterLayer extends Layer {
18
+ protected service?: Service;
19
+ protected _currentImage?: {
20
+ bounds: [number, number, number, number];
21
+ url: string;
22
+ };
23
+ constructor(options?: RasterLayerOptions);
24
+ /**
25
+ * Set time range for temporal data
26
+ */
27
+ setTimeRange(from: Date, to: Date): RasterLayer;
28
+ /**
29
+ * Get time range
30
+ */
31
+ getTimeRange(): [Date?, Date?];
32
+ /**
33
+ * Authenticate with token
34
+ */
35
+ authenticate(token: string): RasterLayer;
36
+ /**
37
+ * Get service metadata
38
+ */
39
+ metadata(callback: (error: Error | null, metadata?: unknown) => void): RasterLayer;
40
+ /**
41
+ * Redraw the layer
42
+ */
43
+ redraw(): RasterLayer;
44
+ protected _createSource(): void;
45
+ protected _createLayer(): void;
46
+ /**
47
+ * Update the layer - to be implemented by subclasses
48
+ */
49
+ protected _update(): void;
50
+ /**
51
+ * Build export parameters - to be implemented by subclasses
52
+ */
53
+ protected _buildExportParams(): Record<string, unknown>;
54
+ /**
55
+ * Request export - to be implemented by subclasses
56
+ */
57
+ protected _requestExport(_params: Record<string, unknown>, _bounds: [number, number, number, number]): void;
58
+ /**
59
+ * Calculate bounding box for current map view
60
+ */
61
+ protected _calculateBbox(): string;
62
+ /**
63
+ * Calculate image size for current map view
64
+ */
65
+ protected _calculateImageSize(): string;
66
+ /**
67
+ * Render image overlay
68
+ */
69
+ protected _renderImage(url: string, bounds: [number, number, number, number]): void;
70
+ }
71
+ export default RasterLayer;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Esri Leaflet Style API Examples
3
3
  * This demonstrates how our implementation now matches Esri Leaflet exactly
4
- * Updated to use Services-only approach
5
4
  */
5
+ import { DynamicMapLayer } from '../Layers/DynamicMapLayer';
6
6
  declare const service: import("../Services/SimpleMapService").MapService;
7
+ declare const dynamicLayer: DynamicMapLayer;
7
8
  declare function exampleAsync(): Promise<void>;
8
- export { service, exampleAsync };
9
+ export { service, dynamicLayer, exampleAsync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esri-gl",
3
- "version": "0.9.0-alpha.9",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "A module for making it easier to use Esri services in mapbox-gl or maplibre-gl.",
6
6
  "main": "dist/esri-gl.js",
@@ -102,15 +102,5 @@
102
102
  "homepage": "https://esri-gl.netlify.app",
103
103
  "demo": "https://esri-gl-demo.netlify.app",
104
104
  "author": "Muhammad Imran Siddique 2025, Rowan Winsemius 2020-2025",
105
- "license": "MIT",
106
- "keywords": [
107
- "mapbox",
108
- "maplibre",
109
- "map",
110
- "esri",
111
- "gl",
112
- "typescript",
113
- "react",
114
- "react-map-gl"
115
- ]
105
+ "license": "MIT"
116
106
  }