ogm-viewer 0.5.0 → 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.
Files changed (114) hide show
  1. package/dist/cjs/{lerc-Df0hDWkS.js → lerc-XQuzL9p2.js} +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. 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-DMEfXquS.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} +11313 -10658
  4. package/dist/cjs/ogm-alerts_11.cjs.entry.js +1 -1
  5. package/dist/cjs/ogm-viewer.cjs.js +1 -1
  6. package/dist/collection/components/ogm-image/ogm-image.js +14 -14
  7. package/dist/collection/components/ogm-map/ogm-map.js +144 -52
  8. package/dist/collection/components/ogm-menubar/ogm-menubar.js +23 -2
  9. package/dist/collection/components/ogm-menubar/ogm-menubar.test.js +34 -0
  10. package/dist/collection/components/ogm-preview/ogm-preview.js +13 -13
  11. package/dist/collection/components/ogm-preview/ogm-preview.test.js +5 -5
  12. package/dist/collection/components/ogm-previews/ogm-previews.js +30 -28
  13. package/dist/collection/components/ogm-previews/ogm-previews.test.js +3 -3
  14. package/dist/collection/components/ogm-viewer/ogm-viewer.css +6 -2
  15. package/dist/collection/components/ogm-viewer/ogm-viewer.js +29 -18
  16. package/dist/collection/lib/geometry.js +35 -1
  17. package/dist/collection/lib/geometry.test.js +90 -1
  18. package/dist/collection/lib/previewers/cog-deck.js +4 -4
  19. package/dist/collection/lib/previewers/cog.js +11 -11
  20. package/dist/collection/lib/previewers/geojson.js +10 -7
  21. package/dist/collection/lib/previewers/map.js +51 -0
  22. package/dist/collection/lib/previewers/openindexmap.js +2 -2
  23. package/dist/collection/lib/previewers/pmtiles-raster.js +9 -9
  24. package/dist/collection/lib/previewers/pmtiles-vector.js +12 -51
  25. package/dist/collection/lib/previewers/previewer.js +4 -3
  26. package/dist/collection/lib/previewers/raster.js +15 -11
  27. package/dist/collection/lib/previewers/tiled-vector.js +47 -0
  28. package/dist/collection/lib/previewers/tilejson-raster.js +27 -0
  29. package/dist/collection/lib/previewers/tilejson-vector.js +18 -0
  30. package/dist/collection/lib/previewers/tilejson.test.js +140 -0
  31. package/dist/collection/lib/previewers/vector.js +7 -4
  32. package/dist/collection/lib/previewers/wms.js +86 -6
  33. package/dist/collection/lib/previewers/wms.test.js +133 -0
  34. package/dist/collection/lib/previewers/wmts.js +31 -0
  35. package/dist/collection/lib/previewers/wmts.test.js +108 -0
  36. package/dist/collection/lib/{sources → resources}/cog.js +2 -2
  37. package/dist/collection/lib/{sources → resources}/geojson.js +3 -3
  38. package/dist/collection/lib/{sources → resources}/iiif-manifest.js +2 -2
  39. package/dist/collection/lib/{sources → resources}/iiif-manifest.test.js +3 -3
  40. package/dist/collection/lib/{sources → resources}/iiif.js +2 -2
  41. package/dist/collection/lib/{sources/maplibre.js → resources/map.js} +2 -2
  42. package/dist/collection/lib/{sources → resources}/openindexmap.js +2 -2
  43. package/dist/collection/lib/{sources → resources}/pmtiles.js +2 -2
  44. package/dist/collection/lib/{sources → resources}/raster.js +2 -2
  45. package/dist/collection/lib/{sources/source.js → resources/resource.js} +3 -3
  46. package/dist/collection/lib/{sources → resources}/tilejson.js +21 -4
  47. package/dist/collection/lib/{sources → resources}/tms.js +2 -2
  48. package/dist/collection/lib/{sources → resources}/vector.js +2 -2
  49. package/dist/collection/lib/{sources → resources}/wms.js +46 -6
  50. package/dist/collection/lib/resources/wms.test.js +63 -0
  51. package/dist/collection/lib/resources/wmts.js +317 -0
  52. package/dist/collection/lib/resources/wmts.test.js +235 -0
  53. package/dist/collection/lib/{sources → resources}/xyz.js +2 -2
  54. package/dist/esm/{lerc-CB_Jcu33.js → lerc-BxCv6y50.js} +1 -1
  55. package/dist/esm/loader.js +1 -1
  56. 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-Dlc6USWB.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} +11313 -10658
  57. package/dist/esm/ogm-alerts_11.entry.js +1 -1
  58. package/dist/esm/ogm-viewer.js +1 -1
  59. package/dist/ogm-viewer/ogm-viewer.esm.js +1 -1
  60. package/dist/ogm-viewer/p-7EhN80oi.js +2822 -0
  61. package/dist/ogm-viewer/{p-DqRDI3AC.js → p-BO_nFj5K.js} +1 -1
  62. package/dist/ogm-viewer/{p-7936ccc9.entry.js → p-c9af56a3.entry.js} +1 -1
  63. package/dist/types/components/ogm-image/ogm-image.d.ts +2 -2
  64. package/dist/types/components/ogm-map/ogm-map.d.ts +13 -9
  65. package/dist/types/components/ogm-menubar/ogm-menubar.d.ts +2 -1
  66. package/dist/types/components/ogm-preview/ogm-preview.d.ts +2 -2
  67. package/dist/types/components/ogm-previews/ogm-previews.d.ts +2 -2
  68. package/dist/types/components/ogm-viewer/ogm-viewer.d.ts +1 -0
  69. package/dist/types/components.d.ts +24 -6
  70. package/dist/types/lib/geometry.d.ts +5 -1
  71. package/dist/types/lib/previewers/cog-deck.d.ts +3 -3
  72. package/dist/types/lib/previewers/cog.d.ts +6 -6
  73. package/dist/types/lib/previewers/geojson.d.ts +7 -4
  74. package/dist/types/lib/previewers/{maplibre.d.ts → map.d.ts} +10 -7
  75. package/dist/types/lib/previewers/openindexmap.d.ts +2 -2
  76. package/dist/types/lib/previewers/pmtiles-raster.d.ts +2 -3
  77. package/dist/types/lib/previewers/pmtiles-vector.d.ts +4 -11
  78. package/dist/types/lib/previewers/previewer.d.ts +3 -3
  79. package/dist/types/lib/previewers/raster.d.ts +10 -7
  80. package/dist/types/lib/previewers/tiled-vector.d.ts +11 -0
  81. package/dist/types/lib/previewers/tilejson-raster.d.ts +8 -0
  82. package/dist/types/lib/previewers/tilejson-vector.d.ts +6 -0
  83. package/dist/types/lib/previewers/vector.d.ts +9 -5
  84. package/dist/types/lib/previewers/wms.d.ts +17 -5
  85. package/dist/types/lib/previewers/wms.test.d.ts +1 -0
  86. package/dist/types/lib/previewers/wmts.d.ts +11 -0
  87. package/dist/types/lib/previewers/wmts.test.d.ts +1 -0
  88. package/dist/types/lib/{sources → resources}/cog.d.ts +2 -2
  89. package/dist/types/lib/{sources → resources}/geojson.d.ts +2 -2
  90. package/dist/types/lib/{sources → resources}/iiif-manifest.d.ts +2 -2
  91. package/dist/types/lib/resources/iiif-manifest.test.d.ts +1 -0
  92. package/dist/types/lib/resources/iiif.d.ts +5 -0
  93. package/dist/types/lib/{sources/maplibre.d.ts → resources/map.d.ts} +2 -2
  94. package/dist/types/lib/resources/openindexmap.d.ts +5 -0
  95. package/dist/types/lib/{sources → resources}/pmtiles.d.ts +2 -2
  96. package/dist/types/lib/{sources → resources}/raster.d.ts +2 -2
  97. package/dist/types/lib/{sources/source.d.ts → resources/resource.d.ts} +1 -1
  98. package/dist/types/lib/{sources → resources}/tilejson.d.ts +5 -2
  99. package/dist/types/lib/resources/tms.d.ts +5 -0
  100. package/dist/types/lib/{sources → resources}/vector.d.ts +2 -2
  101. package/dist/types/lib/{sources → resources}/wms.d.ts +15 -5
  102. package/dist/types/lib/resources/wms.test.d.ts +1 -0
  103. package/dist/types/lib/resources/wmts.d.ts +59 -0
  104. package/dist/types/lib/resources/wmts.test.d.ts +1 -0
  105. package/dist/types/lib/resources/xyz.d.ts +5 -0
  106. package/package.json +1 -1
  107. package/readme.md +1 -0
  108. package/dist/collection/lib/previewers/maplibre.js +0 -56
  109. package/dist/ogm-viewer/p-CWtUrqsM.js +0 -2822
  110. package/dist/types/lib/sources/iiif.d.ts +0 -5
  111. package/dist/types/lib/sources/openindexmap.d.ts +0 -5
  112. package/dist/types/lib/sources/tms.d.ts +0 -5
  113. package/dist/types/lib/sources/xyz.d.ts +0 -5
  114. /package/dist/types/lib/{sources/iiif-manifest.test.d.ts → previewers/tilejson.test.d.ts} +0 -0
@@ -1,11 +1,14 @@
1
- import type { RasterSourceSpecification, RasterLayerSpecification } from 'maplibre-gl';
2
- import MapLibrePreviewer from './maplibre';
3
- import type RasterSource from '../sources/raster';
4
- export default class RasterPreviewer extends MapLibrePreviewer {
5
- protected source: RasterSource;
6
- protected createSource(): Promise<RasterSourceSpecification>;
1
+ import type { RasterSourceSpecification, LayerSpecification } from 'maplibre-gl';
2
+ import MapPreviewer from './map';
3
+ import type RasterResource from '../resources/raster';
4
+ export type AddRasterSourceObject = RasterSourceSpecification & {
5
+ id: string;
6
+ };
7
+ export default class RasterPreviewer extends MapPreviewer {
8
+ protected resource: RasterResource;
9
+ protected createSources(): Promise<AddRasterSourceObject[]>;
7
10
  protected getSourceId(): string;
8
- protected createLayers(): Promise<RasterLayerSpecification[]>;
11
+ protected createLayers(): Promise<LayerSpecification[]>;
9
12
  getBounds(): Promise<maplibregl.LngLatBoundsLike | undefined>;
10
13
  setOpacity(opacity: number): Promise<void>;
11
14
  }
@@ -0,0 +1,11 @@
1
+ import VectorPreviewer from './vector';
2
+ import type { FillLayerSpecification, LineLayerSpecification, CircleLayerSpecification, SymbolLayerSpecification } from 'maplibre-gl';
3
+ export default abstract class TiledVectorPreviewer extends VectorPreviewer {
4
+ protected createPolygonLayer(layerId: string): FillLayerSpecification;
5
+ protected createPolygonOutlineLayer(layerId: string): LineLayerSpecification;
6
+ protected createLineLayer(layerId: string): LineLayerSpecification;
7
+ protected createPointLayer(layerId: string): CircleLayerSpecification;
8
+ protected createPolygonLabelLayer(layerId: string): SymbolLayerSpecification;
9
+ protected createLineLabelLayer(layerId: string): SymbolLayerSpecification;
10
+ protected createPointLabelLayer(layerId: string): SymbolLayerSpecification;
11
+ }
@@ -0,0 +1,8 @@
1
+ import RasterPreviewer from './raster';
2
+ import type { AddRasterSourceObject } from './raster';
3
+ export default class TileJsonRasterPreviewer extends RasterPreviewer {
4
+ protected createSources(): Promise<AddRasterSourceObject[]>;
5
+ protected getSourceId(): string;
6
+ getBounds(): Promise<maplibregl.LngLatBoundsLike | undefined>;
7
+ private get tilejson();
8
+ }
@@ -0,0 +1,6 @@
1
+ import TiledVectorPreviewer from './tiled-vector';
2
+ import type { AddVectorSourceObject } from './vector';
3
+ export default class TileJsonVectorPreviewer extends TiledVectorPreviewer {
4
+ protected getSourceId(): string;
5
+ protected createSources(): Promise<AddVectorSourceObject[]>;
6
+ }
@@ -1,8 +1,12 @@
1
- import MapLibrePreviewer from './maplibre';
2
- import type { FillLayerSpecification, LineLayerSpecification, CircleLayerSpecification, SymbolLayerSpecification, LayerSpecification } from 'maplibre-gl';
3
- import type VectorSource from '../sources/vector';
4
- export default abstract class VectorPreviewer extends MapLibrePreviewer {
5
- protected source: VectorSource;
1
+ import MapPreviewer from './map';
2
+ import type { FillLayerSpecification, LineLayerSpecification, CircleLayerSpecification, SymbolLayerSpecification, LayerSpecification, VectorSourceSpecification } from 'maplibre-gl';
3
+ import type VectorResource from '../resources/vector';
4
+ export type AddVectorSourceObject = VectorSourceSpecification & {
5
+ id: string;
6
+ };
7
+ export default abstract class VectorPreviewer extends MapPreviewer {
8
+ protected resource: VectorResource;
9
+ protected getSourceId(): string;
6
10
  setOpacity(opacity: number): Promise<void>;
7
11
  getBounds(): Promise<import("maplibre-gl").LngLatBoundsLike>;
8
12
  protected createLayers(): Promise<LayerSpecification[]>;
@@ -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 source: WmsSource;
6
- protected createSource(): Promise<RasterSourceSpecification>;
7
- protected getSourceId(): string;
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 RasterSource from './raster';
2
- export default class CogSource extends RasterSource {
1
+ import RasterResource from './raster';
2
+ export default class CogResource extends RasterResource {
3
3
  label(): string;
4
4
  getMapLibreSourceUrl(): string;
5
5
  getScheme(): any;
@@ -1,5 +1,5 @@
1
- import VectorSource from './vector';
2
- export default class GeoJSONSource extends VectorSource {
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 IIIFSource from './iiif';
4
- export default class IIIFManifestSource extends IIIFSource {
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 {};
@@ -0,0 +1,5 @@
1
+ import Resource from './resource';
2
+ export default class IIIFResource extends Resource {
3
+ label(): string;
4
+ getIIIFImageUrls(): Promise<string[]>;
5
+ }
@@ -1,6 +1,6 @@
1
1
  import type { SourceSpecification } from 'maplibre-gl';
2
- import Source from './source';
3
- export default abstract class MapLibreSource extends Source {
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']>;
@@ -0,0 +1,5 @@
1
+ import GeoJsonResource from './geojson';
2
+ export default class OpenIndexMapResource extends GeoJsonResource {
3
+ getVectorLayers(): Promise<string[]>;
4
+ label(): string;
5
+ }
@@ -1,5 +1,5 @@
1
1
  import { Header } from 'pmtiles';
2
- import Source from './source';
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 PMTilesSource extends Source {
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 MapLibreSource from './maplibre';
2
- export default abstract class RasterSource extends MapLibreSource {
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,5 +1,5 @@
1
1
  import type { LngLatBoundsLike } from 'maplibre-gl';
2
- export default abstract class Source {
2
+ export default abstract class Resource {
3
3
  url: string;
4
4
  protected bounds: LngLatBoundsLike | undefined;
5
5
  id: string;
@@ -1,10 +1,13 @@
1
- import Source from './source';
2
- export default class TileJSONSource extends Source {
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">;
@@ -0,0 +1,5 @@
1
+ import RasterResource from './raster';
2
+ export default class TmsResource extends RasterResource {
3
+ label(): string;
4
+ getScheme(): "tms";
5
+ }
@@ -1,6 +1,6 @@
1
1
  import { SourceSpecification } from 'maplibre-gl';
2
- import MapLibreSource from './maplibre';
3
- export default abstract class VectorSource extends MapLibreSource {
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 RasterSource from './raster';
2
+ import RasterResource from './raster';
3
3
  type WmsOptions = {
4
4
  layerIds: string[];
5
5
  bbox?: string;
6
- srs?: string;
6
+ crs?: string;
7
7
  tileSize?: number;
8
8
  format?: string;
9
9
  transparent?: boolean;
10
10
  version?: string;
11
11
  };
12
- export default class WmsSource extends RasterSource {
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
- private get tilesUrl();
22
- private get capabilitiesUrl();
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 {};
@@ -0,0 +1,5 @@
1
+ import RasterResource from './raster';
2
+ export default class XyzResource extends RasterResource {
3
+ label(): string;
4
+ getScheme(): "xyz";
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ogm-viewer",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "A web-based viewer for previewing OpenGeoMetadata records",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
package/readme.md CHANGED
@@ -109,6 +109,7 @@ After tagging, build the project and publish it to npm:
109
109
 
110
110
  ```bash
111
111
  npm run build
112
+ npm login
112
113
  npm publish
113
114
  ```
114
115
 
@@ -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
- }