ogm-viewer 0.5.1 → 0.6.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/dist/cjs/{lerc-IU-tWkVO.js → lerc-XQuzL9p2.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-BAGJpqMB.js → ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-B4jkHqvr.js} +11302 -10648
- package/dist/cjs/ogm-alerts_11.cjs.entry.js +1 -1
- package/dist/cjs/ogm-viewer.cjs.js +1 -1
- package/dist/collection/components/ogm-image/ogm-image.js +14 -14
- package/dist/collection/components/ogm-map/ogm-map.js +135 -53
- package/dist/collection/components/ogm-preview/ogm-preview.js +13 -13
- package/dist/collection/components/ogm-preview/ogm-preview.test.js +5 -5
- package/dist/collection/components/ogm-previews/ogm-previews.js +29 -26
- package/dist/collection/components/ogm-previews/ogm-previews.test.js +1 -1
- package/dist/collection/lib/geometry.js +35 -1
- package/dist/collection/lib/geometry.test.js +90 -1
- package/dist/collection/lib/previewers/cog-deck.js +4 -4
- package/dist/collection/lib/previewers/cog.js +11 -11
- package/dist/collection/lib/previewers/geojson.js +10 -7
- package/dist/collection/lib/previewers/map.js +51 -0
- package/dist/collection/lib/previewers/openindexmap.js +2 -2
- package/dist/collection/lib/previewers/pmtiles-raster.js +9 -9
- package/dist/collection/lib/previewers/pmtiles-vector.js +12 -51
- package/dist/collection/lib/previewers/previewer.js +4 -3
- package/dist/collection/lib/previewers/raster.js +15 -11
- package/dist/collection/lib/previewers/tiled-vector.js +47 -0
- package/dist/collection/lib/previewers/tilejson-raster.js +27 -0
- package/dist/collection/lib/previewers/tilejson-vector.js +18 -0
- package/dist/collection/lib/previewers/tilejson.test.js +140 -0
- package/dist/collection/lib/previewers/vector.js +7 -4
- package/dist/collection/lib/previewers/wms.js +86 -6
- package/dist/collection/lib/previewers/wms.test.js +133 -0
- package/dist/collection/lib/previewers/wmts.js +31 -0
- package/dist/collection/lib/previewers/wmts.test.js +108 -0
- package/dist/collection/lib/{sources → resources}/cog.js +2 -2
- package/dist/collection/lib/{sources → resources}/geojson.js +3 -3
- package/dist/collection/lib/{sources → resources}/iiif-manifest.js +2 -2
- package/dist/collection/lib/{sources → resources}/iiif-manifest.test.js +3 -3
- package/dist/collection/lib/{sources → resources}/iiif.js +2 -2
- package/dist/collection/lib/{sources/maplibre.js → resources/map.js} +2 -2
- package/dist/collection/lib/{sources → resources}/openindexmap.js +2 -2
- package/dist/collection/lib/{sources → resources}/pmtiles.js +2 -2
- package/dist/collection/lib/{sources → resources}/raster.js +2 -2
- package/dist/collection/lib/{sources/source.js → resources/resource.js} +3 -3
- package/dist/collection/lib/{sources → resources}/tilejson.js +21 -4
- package/dist/collection/lib/{sources → resources}/tms.js +2 -2
- package/dist/collection/lib/{sources → resources}/vector.js +2 -2
- package/dist/collection/lib/{sources → resources}/wms.js +46 -6
- package/dist/collection/lib/resources/wms.test.js +63 -0
- package/dist/collection/lib/resources/wmts.js +317 -0
- package/dist/collection/lib/resources/wmts.test.js +235 -0
- package/dist/collection/lib/{sources → resources}/xyz.js +2 -2
- package/dist/esm/{lerc-yC3LNu-h.js → lerc-BxCv6y50.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-BpVupgSB.js → ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-DtEO48bS.js} +11302 -10648
- package/dist/esm/ogm-alerts_11.entry.js +1 -1
- package/dist/esm/ogm-viewer.js +1 -1
- package/dist/ogm-viewer/ogm-viewer.esm.js +1 -1
- package/dist/ogm-viewer/p-7EhN80oi.js +2822 -0
- package/dist/ogm-viewer/{p-_eTjrSO2.js → p-BO_nFj5K.js} +1 -1
- package/dist/ogm-viewer/{p-11cf948e.entry.js → p-c9af56a3.entry.js} +1 -1
- package/dist/types/components/ogm-image/ogm-image.d.ts +2 -2
- package/dist/types/components/ogm-map/ogm-map.d.ts +12 -9
- package/dist/types/components/ogm-preview/ogm-preview.d.ts +2 -2
- package/dist/types/components/ogm-previews/ogm-previews.d.ts +2 -2
- package/dist/types/components.d.ts +6 -6
- package/dist/types/lib/geometry.d.ts +5 -1
- package/dist/types/lib/previewers/cog-deck.d.ts +3 -3
- package/dist/types/lib/previewers/cog.d.ts +6 -6
- package/dist/types/lib/previewers/geojson.d.ts +7 -4
- package/dist/types/lib/previewers/{maplibre.d.ts → map.d.ts} +10 -7
- package/dist/types/lib/previewers/openindexmap.d.ts +2 -2
- package/dist/types/lib/previewers/pmtiles-raster.d.ts +2 -3
- package/dist/types/lib/previewers/pmtiles-vector.d.ts +4 -11
- package/dist/types/lib/previewers/previewer.d.ts +3 -3
- package/dist/types/lib/previewers/raster.d.ts +10 -7
- package/dist/types/lib/previewers/tiled-vector.d.ts +11 -0
- package/dist/types/lib/previewers/tilejson-raster.d.ts +8 -0
- package/dist/types/lib/previewers/tilejson-vector.d.ts +6 -0
- package/dist/types/lib/previewers/vector.d.ts +9 -5
- package/dist/types/lib/previewers/wms.d.ts +17 -5
- package/dist/types/lib/previewers/wms.test.d.ts +1 -0
- package/dist/types/lib/previewers/wmts.d.ts +11 -0
- package/dist/types/lib/previewers/wmts.test.d.ts +1 -0
- package/dist/types/lib/{sources → resources}/cog.d.ts +2 -2
- package/dist/types/lib/{sources → resources}/geojson.d.ts +2 -2
- package/dist/types/lib/{sources → resources}/iiif-manifest.d.ts +2 -2
- package/dist/types/lib/resources/iiif-manifest.test.d.ts +1 -0
- package/dist/types/lib/resources/iiif.d.ts +5 -0
- package/dist/types/lib/{sources/maplibre.d.ts → resources/map.d.ts} +2 -2
- package/dist/types/lib/resources/openindexmap.d.ts +5 -0
- package/dist/types/lib/{sources → resources}/pmtiles.d.ts +2 -2
- package/dist/types/lib/{sources → resources}/raster.d.ts +2 -2
- package/dist/types/lib/{sources/source.d.ts → resources/resource.d.ts} +1 -1
- package/dist/types/lib/{sources → resources}/tilejson.d.ts +5 -2
- package/dist/types/lib/resources/tms.d.ts +5 -0
- package/dist/types/lib/{sources → resources}/vector.d.ts +2 -2
- package/dist/types/lib/{sources → resources}/wms.d.ts +15 -5
- package/dist/types/lib/resources/wms.test.d.ts +1 -0
- package/dist/types/lib/resources/wmts.d.ts +59 -0
- package/dist/types/lib/resources/wmts.test.d.ts +1 -0
- package/dist/types/lib/resources/xyz.d.ts +5 -0
- package/package.json +1 -1
- package/dist/collection/lib/previewers/maplibre.js +0 -56
- package/dist/ogm-viewer/p-DPOGJxir.js +0 -2822
- package/dist/types/lib/sources/iiif.d.ts +0 -5
- package/dist/types/lib/sources/openindexmap.d.ts +0 -5
- package/dist/types/lib/sources/tms.d.ts +0 -5
- package/dist/types/lib/sources/xyz.d.ts +0 -5
- /package/dist/types/lib/{sources/iiif-manifest.test.d.ts → previewers/tilejson.test.d.ts} +0 -0
|
@@ -1,8 +1,20 @@
|
|
|
1
|
+
import type { CircleLayerSpecification, LayerSpecification, LineLayerSpecification, MapGeoJSONFeature } from 'maplibre-gl';
|
|
2
|
+
import type WmsResource from '../resources/wms';
|
|
3
|
+
import type { GetFeatureInfoOptions } from '../resources/wms';
|
|
4
|
+
import type { AddRasterSourceObject } from './raster';
|
|
1
5
|
import RasterPreviewer from './raster';
|
|
2
|
-
import type WmsSource from '../sources/wms';
|
|
3
|
-
import { RasterSourceSpecification } from 'maplibre-gl';
|
|
4
6
|
export default class WmsPreviewer extends RasterPreviewer {
|
|
5
|
-
protected
|
|
6
|
-
protected
|
|
7
|
-
|
|
7
|
+
protected resource: WmsResource;
|
|
8
|
+
protected createSources(): Promise<AddRasterSourceObject[]>;
|
|
9
|
+
getSourceId(): string;
|
|
10
|
+
protected get highlightSourceId(): string;
|
|
11
|
+
preview(): Promise<void>;
|
|
12
|
+
clearPreview(): Promise<void>;
|
|
13
|
+
highlightFeatures(features: MapGeoJSONFeature[]): void;
|
|
14
|
+
clearHighlight(): void;
|
|
15
|
+
inspect(options: GetFeatureInfoOptions): Promise<Response>;
|
|
16
|
+
protected createLayers(): Promise<LayerSpecification[]>;
|
|
17
|
+
protected createHighlightOutlineLayer(): LineLayerSpecification;
|
|
18
|
+
protected createHighlightPointLayer(): CircleLayerSpecification;
|
|
19
|
+
private get highlightSource();
|
|
8
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import RasterPreviewer from './raster';
|
|
2
|
+
import type WmtsResource from '../resources/wmts';
|
|
3
|
+
import type { WmtsLayer } from '../resources/wmts';
|
|
4
|
+
import type { AddRasterSourceObject } from './raster';
|
|
5
|
+
import type { RasterLayerSpecification } from 'maplibre-gl';
|
|
6
|
+
export default class WmtsPreviewer extends RasterPreviewer {
|
|
7
|
+
protected resource: WmtsResource;
|
|
8
|
+
protected layers: WmtsLayer[];
|
|
9
|
+
protected createSources(): Promise<AddRasterSourceObject[]>;
|
|
10
|
+
protected createLayers(): Promise<RasterLayerSpecification[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import VectorResource from './vector';
|
|
2
|
+
export default class GeoJsonResource extends VectorResource {
|
|
3
3
|
private data;
|
|
4
4
|
protected getData(): Promise<any>;
|
|
5
5
|
label(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import iiif3 from '@iiif/presentation-3';
|
|
2
2
|
import iiif2 from '@iiif/presentation-2';
|
|
3
|
-
import
|
|
4
|
-
export default class
|
|
3
|
+
import IIIFResource from './iiif';
|
|
4
|
+
export default class IIIFManifestResource extends IIIFResource {
|
|
5
5
|
protected manifest: iiif3.Manifest | iiif2.Manifest | undefined;
|
|
6
6
|
label(): string;
|
|
7
7
|
getIIIFImageUrls(): Promise<string[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SourceSpecification } from 'maplibre-gl';
|
|
2
|
-
import
|
|
3
|
-
export default abstract class
|
|
2
|
+
import Resource from './resource';
|
|
3
|
+
export default abstract class MapResource extends Resource {
|
|
4
4
|
getMapLibreSourceUrl(): string;
|
|
5
5
|
abstract isVector(): Promise<boolean>;
|
|
6
6
|
abstract getMapLibreSourceType(): Promise<SourceSpecification['type']>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Header } from 'pmtiles';
|
|
2
|
-
import
|
|
2
|
+
import Resource from './resource';
|
|
3
3
|
import { type LngLatBoundsLike } from 'maplibre-gl';
|
|
4
4
|
interface VectorLayer {
|
|
5
5
|
id: string;
|
|
@@ -8,7 +8,7 @@ interface Metadata {
|
|
|
8
8
|
type?: string;
|
|
9
9
|
vector_layers: VectorLayer[];
|
|
10
10
|
}
|
|
11
|
-
export default class
|
|
11
|
+
export default class PMTilesResource extends Resource {
|
|
12
12
|
private archive;
|
|
13
13
|
private metadata;
|
|
14
14
|
private header;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default abstract class
|
|
1
|
+
import MapResource from './map';
|
|
2
|
+
export default abstract class RasterResource extends MapResource {
|
|
3
3
|
isVector(): Promise<boolean>;
|
|
4
4
|
getTileSize(): number | undefined;
|
|
5
5
|
getMapLibreSourceType(): Promise<"raster">;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import MapResource from './map';
|
|
2
|
+
export default class TileJsonResource extends MapResource {
|
|
3
3
|
private metadata;
|
|
4
4
|
label(): string;
|
|
5
|
+
getMapLibreSourceUrl(): string;
|
|
6
|
+
getScheme(): any;
|
|
5
7
|
protected getMetadata(): Promise<any>;
|
|
6
8
|
isVector(): Promise<boolean>;
|
|
7
9
|
getBounds(): Promise<import("maplibre-gl").LngLatBoundsLike>;
|
|
10
|
+
getTileSize(): Promise<number>;
|
|
8
11
|
getVectorLayers(): Promise<any>;
|
|
9
12
|
getVectorEncoding(): Promise<"mvt" | "mlt">;
|
|
10
13
|
getMapLibreSourceType(): Promise<"vector" | "raster">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SourceSpecification } from 'maplibre-gl';
|
|
2
|
-
import
|
|
3
|
-
export default abstract class
|
|
2
|
+
import MapResource from './map';
|
|
3
|
+
export default abstract class VectorResource extends MapResource {
|
|
4
4
|
isVector(): Promise<boolean>;
|
|
5
5
|
getMapLibreSourceType(): Promise<SourceSpecification['type']>;
|
|
6
6
|
abstract getVectorLayers(): Promise<string[]>;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { type LngLatBoundsLike } from 'maplibre-gl';
|
|
2
|
-
import
|
|
2
|
+
import RasterResource from './raster';
|
|
3
3
|
type WmsOptions = {
|
|
4
4
|
layerIds: string[];
|
|
5
5
|
bbox?: string;
|
|
6
|
-
|
|
6
|
+
crs?: string;
|
|
7
7
|
tileSize?: number;
|
|
8
8
|
format?: string;
|
|
9
9
|
transparent?: boolean;
|
|
10
10
|
version?: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type GetFeatureInfoOptions = {
|
|
13
|
+
bbox: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
export default class WmsResource extends RasterResource {
|
|
13
20
|
private options;
|
|
14
21
|
private metadata;
|
|
15
22
|
constructor(id: string, url: string, options: WmsOptions, bounds?: LngLatBoundsLike);
|
|
@@ -18,7 +25,10 @@ export default class WmsSource extends RasterSource {
|
|
|
18
25
|
getMapLibreSourceUrl(): string;
|
|
19
26
|
getScheme(): any;
|
|
20
27
|
getTileSize(): number;
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
inspect(options: GetFeatureInfoOptions): Promise<Response>;
|
|
29
|
+
protected get tilesUrl(): string;
|
|
30
|
+
protected inspectUrl(inspectOptions: GetFeatureInfoOptions): string;
|
|
31
|
+
protected get isVersion130(): boolean;
|
|
32
|
+
protected get capabilitiesUrl(): string;
|
|
23
33
|
}
|
|
24
34
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type LngLatBoundsLike, type RasterSourceSpecification } from 'maplibre-gl';
|
|
2
|
+
import RasterResource from './raster';
|
|
3
|
+
export type WmtsOptions = {
|
|
4
|
+
layerIds: string[];
|
|
5
|
+
tileSize?: number;
|
|
6
|
+
};
|
|
7
|
+
export type Bounds = NonNullable<RasterSourceSpecification['bounds']>;
|
|
8
|
+
export type WmtsLayer = {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
tileUrls: string[];
|
|
12
|
+
tileSize: number;
|
|
13
|
+
minzoom: number;
|
|
14
|
+
maxzoom: number;
|
|
15
|
+
bounds?: Bounds;
|
|
16
|
+
};
|
|
17
|
+
type XyzGrid = {
|
|
18
|
+
tileSize: number;
|
|
19
|
+
minzoom: number;
|
|
20
|
+
maxzoom: number;
|
|
21
|
+
levelPrefix: string;
|
|
22
|
+
};
|
|
23
|
+
type TileMatrixSet = {
|
|
24
|
+
id: string;
|
|
25
|
+
crs: string;
|
|
26
|
+
grid?: XyzGrid;
|
|
27
|
+
};
|
|
28
|
+
type TileMatrix = {
|
|
29
|
+
zoom: number;
|
|
30
|
+
prefix: string;
|
|
31
|
+
tileWidth: number;
|
|
32
|
+
tileHeight: number;
|
|
33
|
+
matrixWidth: number;
|
|
34
|
+
matrixHeight: number;
|
|
35
|
+
topLeft: number[];
|
|
36
|
+
};
|
|
37
|
+
export default class WmtsResource extends RasterResource {
|
|
38
|
+
private options;
|
|
39
|
+
private metadata;
|
|
40
|
+
constructor(id: string, url: string, options: WmtsOptions, bounds?: LngLatBoundsLike);
|
|
41
|
+
label(): string;
|
|
42
|
+
protected getMetadata(): Promise<Document>;
|
|
43
|
+
getLayers(): Promise<WmtsLayer[]>;
|
|
44
|
+
protected isRequested(element: Element): boolean;
|
|
45
|
+
protected createLayer(element: Element, tileMatrixSets: Map<string, TileMatrixSet>): WmtsLayer | undefined;
|
|
46
|
+
protected parseBounds(element: Element): Bounds | undefined;
|
|
47
|
+
protected recordBounds(): Bounds | undefined;
|
|
48
|
+
protected boundsMinzoom(bounds: Bounds | undefined): number;
|
|
49
|
+
protected preferKnownHost(templates: string[]): string[];
|
|
50
|
+
protected getLinkedTileMatrixSets(element: Element, tileMatrixSets: Map<string, TileMatrixSet>): TileMatrixSet[];
|
|
51
|
+
protected getTileMatrixSets(metadata: Document): Map<string, TileMatrixSet>;
|
|
52
|
+
protected parseTileMatrixSet(element: Element): TileMatrixSet | undefined;
|
|
53
|
+
protected parseXyzGrid(element: Element, crs: string): XyzGrid | undefined;
|
|
54
|
+
protected parseTileMatrix(element: Element): TileMatrix | undefined;
|
|
55
|
+
protected formatTileUrl(template: string, style: string, tileMatrixSet: TileMatrixSet, dimensionDefaults?: Record<string, string>): string;
|
|
56
|
+
protected unsupportedGridMessage(elements: Element[], tileMatrixSets: Map<string, TileMatrixSet>): string;
|
|
57
|
+
getScheme(): "xyz";
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import Previewer from "./previewer";
|
|
2
|
-
export default class MapLibrePreviewer extends Previewer {
|
|
3
|
-
// Store reference to the map and styles
|
|
4
|
-
style;
|
|
5
|
-
map;
|
|
6
|
-
// Stored state for added source and layers to allow for cleanup
|
|
7
|
-
sourceId = null;
|
|
8
|
-
layerIds = [];
|
|
9
|
-
// Current opacity state
|
|
10
|
-
opacity;
|
|
11
|
-
// Initialize with opacity at the theme's opacity value
|
|
12
|
-
constructor(source, map, style) {
|
|
13
|
-
super(source);
|
|
14
|
-
this.map = map;
|
|
15
|
-
this.style = style;
|
|
16
|
-
this.opacity = this.style.opacity;
|
|
17
|
-
}
|
|
18
|
-
// Add source and preview layers if they don't already exist
|
|
19
|
-
async preview() {
|
|
20
|
-
if (!this.sourceId) {
|
|
21
|
-
if (this.map.getSource(this.getSourceId())) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const source = await this.createSource();
|
|
25
|
-
this.map.addSource(this.getSourceId(), source);
|
|
26
|
-
this.sourceId = this.getSourceId();
|
|
27
|
-
}
|
|
28
|
-
if (this.layerIds.length == 0) {
|
|
29
|
-
const layers = await this.createLayers();
|
|
30
|
-
layers.forEach(layer => {
|
|
31
|
-
if (this.map.getLayer(layer.id)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
this.map.addLayer(layer);
|
|
35
|
-
this.layerIds.push(layer.id);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Remove preview layers and source
|
|
40
|
-
async clearPreview() {
|
|
41
|
-
this.layerIds.forEach(layerId => {
|
|
42
|
-
if (this.map.getLayer(layerId)) {
|
|
43
|
-
this.map.removeLayer(layerId);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
this.layerIds = [];
|
|
47
|
-
if (this.sourceId && this.map.getSource(this.getSourceId())) {
|
|
48
|
-
this.map.removeSource(this.getSourceId());
|
|
49
|
-
this.sourceId = null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Unique name for the MapLibre source; default to provided source ID
|
|
53
|
-
getSourceId() {
|
|
54
|
-
return this.source.id;
|
|
55
|
-
}
|
|
56
|
-
}
|