@honua/sdk-esri-compat 0.0.6-alpha.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 +5 -0
- package/contract/edit-session.d.ts +203 -0
- package/contract/edit-session.d.ts.map +1 -0
- package/contract/edit-session.js +717 -0
- package/contract/index.d.ts +20 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +15 -0
- package/contract/jobs.d.ts +115 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +22 -0
- package/contract/source.d.ts +138 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3364 -0
- package/contract/spatial-aggregation.d.ts +312 -0
- package/contract/spatial-aggregation.d.ts.map +1 -0
- package/contract/spatial-aggregation.js +196 -0
- package/contract/types.d.ts +542 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +171 -0
- package/core/batch.d.ts +37 -0
- package/core/batch.d.ts.map +1 -0
- package/core/batch.js +78 -0
- package/core/cache-state.d.ts +76 -0
- package/core/cache-state.d.ts.map +1 -0
- package/core/cache-state.js +84 -0
- package/core/client.d.ts +289 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +2625 -0
- package/core/errors.d.ts +68 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +116 -0
- package/core/grpc-adapter.d.ts +23 -0
- package/core/grpc-adapter.d.ts.map +1 -0
- package/core/grpc-adapter.js +704 -0
- package/core/odata.d.ts +347 -0
- package/core/odata.d.ts.map +1 -0
- package/core/odata.js +837 -0
- package/core/ogc-conformance.d.ts +35 -0
- package/core/ogc-conformance.d.ts.map +1 -0
- package/core/ogc-conformance.js +121 -0
- package/core/ogc-maps.d.ts +45 -0
- package/core/ogc-maps.d.ts.map +1 -0
- package/core/ogc-maps.js +53 -0
- package/core/ogc-processes.d.ts +92 -0
- package/core/ogc-processes.d.ts.map +1 -0
- package/core/ogc-processes.js +325 -0
- package/core/ogc-tiles.d.ts +55 -0
- package/core/ogc-tiles.d.ts.map +1 -0
- package/core/ogc-tiles.js +81 -0
- package/core/pbf-decoder.d.ts +28 -0
- package/core/pbf-decoder.d.ts.map +1 -0
- package/core/pbf-decoder.js +627 -0
- package/core/query-builder.d.ts +261 -0
- package/core/query-builder.d.ts.map +1 -0
- package/core/query-builder.js +538 -0
- package/core/spatial-filter.d.ts +93 -0
- package/core/spatial-filter.d.ts.map +1 -0
- package/core/spatial-filter.js +153 -0
- package/core/stac.d.ts +43 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +116 -0
- package/core/surfaces.d.ts +464 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1322 -0
- package/core/types.d.ts +1238 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +13 -0
- package/core/wfs-capabilities.d.ts +143 -0
- package/core/wfs-capabilities.d.ts.map +1 -0
- package/core/wfs-capabilities.js +478 -0
- package/core/wfs-filter.d.ts +118 -0
- package/core/wfs-filter.d.ts.map +1 -0
- package/core/wfs-filter.js +586 -0
- package/core/wfs.d.ts +219 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +406 -0
- package/core/wms-capabilities.d.ts +110 -0
- package/core/wms-capabilities.d.ts.map +1 -0
- package/core/wms-capabilities.js +566 -0
- package/core/wms-types.d.ts +128 -0
- package/core/wms-types.d.ts.map +1 -0
- package/core/wms-types.js +32 -0
- package/core/wms.d.ts +108 -0
- package/core/wms.d.ts.map +1 -0
- package/core/wms.js +182 -0
- package/core/wmts-capabilities.d.ts +82 -0
- package/core/wmts-capabilities.d.ts.map +1 -0
- package/core/wmts-capabilities.js +409 -0
- package/core/wmts.d.ts +80 -0
- package/core/wmts.d.ts.map +1 -0
- package/core/wmts.js +173 -0
- package/esri-compat/basemap-gallery.d.ts +38 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -0
- package/esri-compat/basemap-gallery.js +159 -0
- package/esri-compat/basemap-layer-list.d.ts +35 -0
- package/esri-compat/basemap-layer-list.d.ts.map +1 -0
- package/esri-compat/basemap-layer-list.js +139 -0
- package/esri-compat/basemap.d.ts +32 -0
- package/esri-compat/basemap.d.ts.map +1 -0
- package/esri-compat/basemap.js +84 -0
- package/esri-compat/bookmarks.d.ts +36 -0
- package/esri-compat/bookmarks.d.ts.map +1 -0
- package/esri-compat/bookmarks.js +108 -0
- package/esri-compat/class-breaks-renderer.d.ts +50 -0
- package/esri-compat/class-breaks-renderer.d.ts.map +1 -0
- package/esri-compat/class-breaks-renderer.js +164 -0
- package/esri-compat/color.d.ts +22 -0
- package/esri-compat/color.d.ts.map +1 -0
- package/esri-compat/color.js +106 -0
- package/esri-compat/controls.d.ts +174 -0
- package/esri-compat/controls.d.ts.map +1 -0
- package/esri-compat/controls.js +479 -0
- package/esri-compat/coordinate-conversion.d.ts +41 -0
- package/esri-compat/coordinate-conversion.d.ts.map +1 -0
- package/esri-compat/coordinate-conversion.js +125 -0
- package/esri-compat/directions.d.ts +45 -0
- package/esri-compat/directions.d.ts.map +1 -0
- package/esri-compat/directions.js +123 -0
- package/esri-compat/editor.d.ts +47 -0
- package/esri-compat/editor.d.ts.map +1 -0
- package/esri-compat/editor.js +170 -0
- package/esri-compat/esri-config.d.ts +16 -0
- package/esri-compat/esri-config.d.ts.map +1 -0
- package/esri-compat/esri-config.js +23 -0
- package/esri-compat/esri-request.d.ts +17 -0
- package/esri-compat/esri-request.d.ts.map +1 -0
- package/esri-compat/esri-request.js +66 -0
- package/esri-compat/event-bus.d.ts +106 -0
- package/esri-compat/event-bus.d.ts.map +1 -0
- package/esri-compat/event-bus.js +90 -0
- package/esri-compat/expand.d.ts +36 -0
- package/esri-compat/expand.d.ts.map +1 -0
- package/esri-compat/expand.js +97 -0
- package/esri-compat/extent.d.ts +43 -0
- package/esri-compat/extent.d.ts.map +1 -0
- package/esri-compat/extent.js +140 -0
- package/esri-compat/feature-form.d.ts +64 -0
- package/esri-compat/feature-form.d.ts.map +1 -0
- package/esri-compat/feature-form.js +137 -0
- package/esri-compat/feature-layer.d.ts +173 -0
- package/esri-compat/feature-layer.d.ts.map +1 -0
- package/esri-compat/feature-layer.js +655 -0
- package/esri-compat/feature-set.d.ts +32 -0
- package/esri-compat/feature-set.d.ts.map +1 -0
- package/esri-compat/feature-set.js +80 -0
- package/esri-compat/feature-table.d.ts +141 -0
- package/esri-compat/feature-table.d.ts.map +1 -0
- package/esri-compat/feature-table.js +500 -0
- package/esri-compat/feature-templates.d.ts +41 -0
- package/esri-compat/feature-templates.d.ts.map +1 -0
- package/esri-compat/feature-templates.js +97 -0
- package/esri-compat/feature.d.ts +33 -0
- package/esri-compat/feature.d.ts.map +1 -0
- package/esri-compat/feature.js +83 -0
- package/esri-compat/graphic.d.ts +46 -0
- package/esri-compat/graphic.d.ts.map +1 -0
- package/esri-compat/graphic.js +103 -0
- package/esri-compat/graphics-layer.d.ts +49 -0
- package/esri-compat/graphics-layer.d.ts.map +1 -0
- package/esri-compat/graphics-layer.js +185 -0
- package/esri-compat/group-layer.d.ts +48 -0
- package/esri-compat/group-layer.d.ts.map +1 -0
- package/esri-compat/group-layer.js +212 -0
- package/esri-compat/identify.d.ts +71 -0
- package/esri-compat/identify.d.ts.map +1 -0
- package/esri-compat/identify.js +299 -0
- package/esri-compat/identity-manager.d.ts +31 -0
- package/esri-compat/identity-manager.d.ts.map +1 -0
- package/esri-compat/identity-manager.js +115 -0
- package/esri-compat/label-class.d.ts +31 -0
- package/esri-compat/label-class.d.ts.map +1 -0
- package/esri-compat/label-class.js +102 -0
- package/esri-compat/layer-list.d.ts +77 -0
- package/esri-compat/layer-list.d.ts.map +1 -0
- package/esri-compat/layer-list.js +342 -0
- package/esri-compat/legend.d.ts +53 -0
- package/esri-compat/legend.d.ts.map +1 -0
- package/esri-compat/legend.js +254 -0
- package/esri-compat/map-image-layer.d.ts +162 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -0
- package/esri-compat/map-image-layer.js +704 -0
- package/esri-compat/map-view.d.ts +315 -0
- package/esri-compat/map-view.d.ts.map +1 -0
- package/esri-compat/map-view.js +1110 -0
- package/esri-compat/map.d.ts +47 -0
- package/esri-compat/map.d.ts.map +1 -0
- package/esri-compat/map.js +209 -0
- package/esri-compat/measurement-2d.d.ts +61 -0
- package/esri-compat/measurement-2d.d.ts.map +1 -0
- package/esri-compat/measurement-2d.js +184 -0
- package/esri-compat/measurement.d.ts +45 -0
- package/esri-compat/measurement.d.ts.map +1 -0
- package/esri-compat/measurement.js +193 -0
- package/esri-compat/oauth-info.d.ts +35 -0
- package/esri-compat/oauth-info.d.ts.map +1 -0
- package/esri-compat/oauth-info.js +115 -0
- package/esri-compat/picture-marker-symbol.d.ts +35 -0
- package/esri-compat/picture-marker-symbol.d.ts.map +1 -0
- package/esri-compat/picture-marker-symbol.js +126 -0
- package/esri-compat/point.d.ts +31 -0
- package/esri-compat/point.d.ts.map +1 -0
- package/esri-compat/point.js +102 -0
- package/esri-compat/polygon.d.ts +31 -0
- package/esri-compat/polygon.d.ts.map +1 -0
- package/esri-compat/polygon.js +107 -0
- package/esri-compat/polyline.d.ts +31 -0
- package/esri-compat/polyline.d.ts.map +1 -0
- package/esri-compat/polyline.js +107 -0
- package/esri-compat/popup-template.d.ts +55 -0
- package/esri-compat/popup-template.d.ts.map +1 -0
- package/esri-compat/popup-template.js +128 -0
- package/esri-compat/popup.d.ts +54 -0
- package/esri-compat/popup.d.ts.map +1 -0
- package/esri-compat/popup.js +312 -0
- package/esri-compat/print.d.ts +47 -0
- package/esri-compat/print.d.ts.map +1 -0
- package/esri-compat/print.js +105 -0
- package/esri-compat/query.d.ts +46 -0
- package/esri-compat/query.d.ts.map +1 -0
- package/esri-compat/query.js +119 -0
- package/esri-compat/reactive-utils.d.ts +23 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -0
- package/esri-compat/reactive-utils.js +178 -0
- package/esri-compat/request.d.ts +41 -0
- package/esri-compat/request.d.ts.map +1 -0
- package/esri-compat/request.js +253 -0
- package/esri-compat/route-layer.d.ts +59 -0
- package/esri-compat/route-layer.d.ts.map +1 -0
- package/esri-compat/route-layer.js +223 -0
- package/esri-compat/route-task.d.ts +88 -0
- package/esri-compat/route-task.d.ts.map +1 -0
- package/esri-compat/route-task.js +225 -0
- package/esri-compat/scene-view.d.ts +41 -0
- package/esri-compat/scene-view.d.ts.map +1 -0
- package/esri-compat/scene-view.js +68 -0
- package/esri-compat/search.d.ts +112 -0
- package/esri-compat/search.d.ts.map +1 -0
- package/esri-compat/search.js +820 -0
- package/esri-compat/simple-fill-symbol.d.ts +27 -0
- package/esri-compat/simple-fill-symbol.d.ts.map +1 -0
- package/esri-compat/simple-fill-symbol.js +85 -0
- package/esri-compat/simple-line-symbol.d.ts +27 -0
- package/esri-compat/simple-line-symbol.d.ts.map +1 -0
- package/esri-compat/simple-line-symbol.js +85 -0
- package/esri-compat/simple-marker-symbol.d.ts +29 -0
- package/esri-compat/simple-marker-symbol.d.ts.map +1 -0
- package/esri-compat/simple-marker-symbol.js +92 -0
- package/esri-compat/simple-renderer.d.ts +29 -0
- package/esri-compat/simple-renderer.d.ts.map +1 -0
- package/esri-compat/simple-renderer.js +92 -0
- package/esri-compat/sketch.d.ts +64 -0
- package/esri-compat/sketch.d.ts.map +1 -0
- package/esri-compat/sketch.js +227 -0
- package/esri-compat/spatial-reference.d.ts +31 -0
- package/esri-compat/spatial-reference.d.ts.map +1 -0
- package/esri-compat/spatial-reference.js +102 -0
- package/esri-compat/swipe.d.ts +34 -0
- package/esri-compat/swipe.d.ts.map +1 -0
- package/esri-compat/swipe.js +93 -0
- package/esri-compat/table-list.d.ts +36 -0
- package/esri-compat/table-list.d.ts.map +1 -0
- package/esri-compat/table-list.js +126 -0
- package/esri-compat/text-symbol.d.ts +37 -0
- package/esri-compat/text-symbol.d.ts.map +1 -0
- package/esri-compat/text-symbol.js +123 -0
- package/esri-compat/tile-layer.d.ts +52 -0
- package/esri-compat/tile-layer.d.ts.map +1 -0
- package/esri-compat/tile-layer.js +167 -0
- package/esri-compat/time-slider.d.ts +70 -0
- package/esri-compat/time-slider.d.ts.map +1 -0
- package/esri-compat/time-slider.js +208 -0
- package/esri-compat/track.d.ts +51 -0
- package/esri-compat/track.d.ts.map +1 -0
- package/esri-compat/track.js +174 -0
- package/esri-compat/unique-value-renderer.d.ts +41 -0
- package/esri-compat/unique-value-renderer.d.ts.map +1 -0
- package/esri-compat/unique-value-renderer.js +127 -0
- package/esri-compat/url.d.ts +12 -0
- package/esri-compat/url.d.ts.map +1 -0
- package/esri-compat/url.js +54 -0
- package/esri-compat/web-map.d.ts +14 -0
- package/esri-compat/web-map.d.ts.map +1 -0
- package/esri-compat/web-map.js +24 -0
- package/gen/honua/v1/feature_service_pb.d.ts +918 -0
- package/gen/honua/v1/feature_service_pb.d.ts.map +1 -0
- package/gen/honua/v1/feature_service_pb.js +375 -0
- package/index.d.ts +130 -0
- package/index.js +65 -0
- package/package.json +22 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public request/response envelopes for the WMS / WMTS first-party
|
|
3
|
+
* adapter. Kept in their own module so the canonical SDK surface
|
|
4
|
+
* (`src/contract/index.ts`, `src/runtime/index.ts`, `src/index.ts`) can
|
|
5
|
+
* re-export them without dragging the runtime classes into trees that
|
|
6
|
+
* never reference WMS.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { HonuaTypedFeature } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Coordinate reference system identifier accepted by WMS 1.3 endpoints.
|
|
13
|
+
* `EPSG:4326`, `EPSG:3857`, `CRS:84` are first-party; any other string is
|
|
14
|
+
* accepted but the adapter will trust the caller for axis order.
|
|
15
|
+
*/
|
|
16
|
+
export type WmsCrs = "EPSG:4326" | "EPSG:3857" | "CRS:84" | (string & {});
|
|
17
|
+
/** WMS 1.3 GetMap request envelope. */
|
|
18
|
+
export interface WmsMapRequest {
|
|
19
|
+
/** Layer names. Multiple layers are serialized as a comma-separated `LAYERS=` value. */
|
|
20
|
+
layers: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Style names. When present the array length must match `layers`. An
|
|
23
|
+
* empty array (or a missing entry) selects the layer's default style.
|
|
24
|
+
*/
|
|
25
|
+
styles?: readonly string[];
|
|
26
|
+
/** CRS code. Defaults to `EPSG:3857`. */
|
|
27
|
+
crs?: WmsCrs;
|
|
28
|
+
/**
|
|
29
|
+
* Bounding box in the requested CRS. Tuple is the canonical
|
|
30
|
+
* `[minx, miny, maxx, maxy]` shape; the adapter swaps axis order when
|
|
31
|
+
* the CRS is `EPSG:4326` (lat,lon) per WMS 1.3 §6.7.3.2.
|
|
32
|
+
*/
|
|
33
|
+
bbox: readonly [number, number, number, number];
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
/** Image MIME type. Defaults to `image/png`. */
|
|
37
|
+
format?: string;
|
|
38
|
+
/** Whether the rendered image should be transparent. Defaults to `true`. */
|
|
39
|
+
transparent?: boolean;
|
|
40
|
+
/** WMS `TIME` dimension override; falls back to the layer default. */
|
|
41
|
+
time?: string;
|
|
42
|
+
/** WMS `ELEVATION` dimension override. */
|
|
43
|
+
elevation?: string;
|
|
44
|
+
/** Background colour as `0xRRGGBB` or `#RRGGBB`. */
|
|
45
|
+
bgcolor?: string;
|
|
46
|
+
/** Vendor extras forwarded verbatim on the wire. */
|
|
47
|
+
extraParams?: Record<string, string | number | boolean>;
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
}
|
|
50
|
+
/** WMS 1.3 GetFeatureInfo request envelope. */
|
|
51
|
+
export interface WmsFeatureInfoRequest extends WmsMapRequest {
|
|
52
|
+
/** Layers to query. Subset of `layers`. */
|
|
53
|
+
queryLayers: readonly string[];
|
|
54
|
+
/** Pixel column offset within the rendered image. */
|
|
55
|
+
i: number;
|
|
56
|
+
/** Pixel row offset within the rendered image. */
|
|
57
|
+
j: number;
|
|
58
|
+
/** `INFO_FORMAT` MIME type. Defaults to `application/json`. */
|
|
59
|
+
infoFormat?: "application/json" | "text/plain" | "text/html" | (string & {});
|
|
60
|
+
/** Maximum features to return. */
|
|
61
|
+
featureCount?: number;
|
|
62
|
+
}
|
|
63
|
+
/** WMS GetLegendGraphic request envelope. */
|
|
64
|
+
export interface WmsLegendRequest {
|
|
65
|
+
layer: string;
|
|
66
|
+
style?: string;
|
|
67
|
+
format?: string;
|
|
68
|
+
width?: number;
|
|
69
|
+
height?: number;
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
extraParams?: Record<string, string | number | boolean>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Decoded GetFeatureInfo response. `features` carries the canonical
|
|
75
|
+
* typed-feature shape when the wire response was JSON; non-JSON content
|
|
76
|
+
* is exposed through `bytes` so the protocol escape hatch still owns the
|
|
77
|
+
* raw payload.
|
|
78
|
+
*/
|
|
79
|
+
export interface HonuaWmsFeatureInfoResponse<T = Record<string, unknown>> {
|
|
80
|
+
contentType: string;
|
|
81
|
+
/** Decoded features when `infoFormat` was `application/json`. */
|
|
82
|
+
features?: ReadonlyArray<HonuaTypedFeature<T>>;
|
|
83
|
+
/** Raw bytes for non-JSON info formats (text/plain, html, …). */
|
|
84
|
+
bytes?: Uint8Array;
|
|
85
|
+
}
|
|
86
|
+
/** Raw bytes returned by `GetMap` / `GetLegendGraphic`. */
|
|
87
|
+
export interface HonuaWmsImageResponse {
|
|
88
|
+
bytes: Uint8Array;
|
|
89
|
+
contentType: string;
|
|
90
|
+
}
|
|
91
|
+
/** Routing mode for `GetTile`. honua-server advertises both. */
|
|
92
|
+
export type WmtsTileMode = "kvp" | "rest";
|
|
93
|
+
/** WMTS 1.0 GetTile request envelope. */
|
|
94
|
+
export interface WmtsTileRequest {
|
|
95
|
+
layer: string;
|
|
96
|
+
/** Style identifier. Defaults to `default`. */
|
|
97
|
+
style?: string;
|
|
98
|
+
/** TileMatrixSet identifier. Defaults to `WebMercatorQuad`. */
|
|
99
|
+
tileMatrixSet?: string;
|
|
100
|
+
/** TileMatrix identifier (zoom level). */
|
|
101
|
+
tileMatrix: string | number;
|
|
102
|
+
tileRow: number;
|
|
103
|
+
tileCol: number;
|
|
104
|
+
/** Image MIME type. Defaults to `image/png`. */
|
|
105
|
+
format?: string;
|
|
106
|
+
/** Routing mode. Defaults to `rest`. */
|
|
107
|
+
mode?: WmtsTileMode;
|
|
108
|
+
signal?: AbortSignal;
|
|
109
|
+
extraParams?: Record<string, string | number | boolean>;
|
|
110
|
+
}
|
|
111
|
+
/** WMTS 1.0 GetFeatureInfo request envelope. */
|
|
112
|
+
export interface WmtsFeatureInfoRequest extends WmtsTileRequest {
|
|
113
|
+
i: number;
|
|
114
|
+
j: number;
|
|
115
|
+
infoFormat?: "application/json" | "text/plain" | "text/html" | (string & {});
|
|
116
|
+
}
|
|
117
|
+
/** Raw bytes returned by a WMTS `GetTile`. */
|
|
118
|
+
export interface HonuaWmtsTileResponse {
|
|
119
|
+
bytes: Uint8Array;
|
|
120
|
+
contentType: string;
|
|
121
|
+
/** True when the server returned a non-error empty payload (sparse tile). */
|
|
122
|
+
empty: boolean;
|
|
123
|
+
}
|
|
124
|
+
/** WMTS GetFeatureInfo response (mirrors WMS). */
|
|
125
|
+
export type HonuaWmtsFeatureInfoResponse<T = Record<string, unknown>> = HonuaWmsFeatureInfoResponse<T>;
|
|
126
|
+
/** Resolve the RESTful path extension for a WMTS tile `Format` MIME type. */
|
|
127
|
+
export declare function wmtsExtensionForFormat(format: string): string;
|
|
128
|
+
//# sourceMappingURL=wms-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wms-types.d.ts","sourceRoot":"","sources":["../../../src/core/wms-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,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AAED,gDAAgD;AAChD,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC7D,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,CAAC,EAAE,kBAAkB,GAAG,YAAY,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC9E;AAED,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,kDAAkD;AAClD,MAAM,MAAM,4BAA4B,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,2BAA2B,CAAC,CAAC,CAAC,CAAC;AAuBvG,6EAA6E;AAC7E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public request/response envelopes for the WMS / WMTS first-party
|
|
3
|
+
* adapter. Kept in their own module so the canonical SDK surface
|
|
4
|
+
* (`src/contract/index.ts`, `src/runtime/index.ts`, `src/index.ts`) can
|
|
5
|
+
* re-export them without dragging the runtime classes into trees that
|
|
6
|
+
* never reference WMS.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
// ── WMTS wire-format helpers ──────────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* Canonical mapping from WMTS `Format` MIME types to RESTful path
|
|
13
|
+
* extensions. Shared between the wire client (`getWmtsTile` /
|
|
14
|
+
* `featureInfo` URL builders in `src/core/client.ts`) and the MapLibre
|
|
15
|
+
* raster source helper (`buildWmtsRasterSourceSpec` in
|
|
16
|
+
* `src/runtime/source-bridge.ts`) so a caller-supplied `format` lands on
|
|
17
|
+
* the same extension regardless of which surface composes the URL.
|
|
18
|
+
*
|
|
19
|
+
* The map is intentionally narrow — formats not listed here fall back
|
|
20
|
+
* to `png` per the conservative WMTS default. Add a new entry only when
|
|
21
|
+
* honua-server adds first-party support for the encoding.
|
|
22
|
+
*/
|
|
23
|
+
const WMTS_TILE_FORMAT_TO_EXTENSION = new Map([
|
|
24
|
+
["image/png", "png"],
|
|
25
|
+
["image/jpeg", "jpeg"],
|
|
26
|
+
["image/jpg", "jpeg"],
|
|
27
|
+
["image/webp", "webp"],
|
|
28
|
+
]);
|
|
29
|
+
/** Resolve the RESTful path extension for a WMTS tile `Format` MIME type. */
|
|
30
|
+
export function wmtsExtensionForFormat(format) {
|
|
31
|
+
return WMTS_TILE_FORMAT_TO_EXTENSION.get(format.toLowerCase()) ?? "png";
|
|
32
|
+
}
|
package/core/wms.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-party WMS 1.3.0 adapter. `HonuaWms` is the service-level handle
|
|
3
|
+
* returned by `client.wms(serviceId)`; `HonuaWmsLayer` is the bound
|
|
4
|
+
* handle returned by `HonuaWms.layer(name)` that pre-fills the LAYER and
|
|
5
|
+
* default STYLE so per-call envelopes can drop the routing fields.
|
|
6
|
+
*
|
|
7
|
+
* Wire transport lives on `HonuaClient` (`getWmsCapabilities`,
|
|
8
|
+
* `getWmsMap`, `getWmsFeatureInfo`, `getWmsLegend`); this class is the
|
|
9
|
+
* typed surface consumers reach through `Source.protocol("wms")`.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import type { HonuaClient } from "./client.js";
|
|
14
|
+
import type { WmsCapabilities, WmsCapabilityLayer, WmsCapabilityStyle } from "./wms-capabilities.js";
|
|
15
|
+
import type { HonuaWmsFeatureInfoResponse, HonuaWmsImageResponse, WmsFeatureInfoRequest, WmsLegendRequest, WmsMapRequest } from "./wms-types.js";
|
|
16
|
+
export interface HonuaWmsOptions {
|
|
17
|
+
client: HonuaClient;
|
|
18
|
+
serviceId: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Split a WMS `LAYERS=` value (or `locator.typeName` / `spec.layers` of
|
|
22
|
+
* the same shape) into the list of non-empty trimmed layer tokens. Used
|
|
23
|
+
* by the contract WMS adapter and shared style resolver so the
|
|
24
|
+
* single-layer handle rule stays in one place.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseWmsLayerNames(value: string | undefined): readonly string[];
|
|
27
|
+
export interface HonuaWmsLayerOptions extends HonuaWmsOptions {
|
|
28
|
+
/** WMS LAYER name (single layer; multi-layer renders use the parent handle). */
|
|
29
|
+
layerName: string;
|
|
30
|
+
/** Default STYLE for renders / feature-info on this layer. */
|
|
31
|
+
defaultStyleId?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Service-level WMS handle. Use `layer(name)` to bind a single LAYER and
|
|
35
|
+
* style; for multi-layer composites (`LAYERS=a,b,c`) call `map()` /
|
|
36
|
+
* `featureInfo()` directly on this handle.
|
|
37
|
+
*/
|
|
38
|
+
export declare class HonuaWms {
|
|
39
|
+
readonly client: HonuaClient;
|
|
40
|
+
readonly serviceId: string;
|
|
41
|
+
private capabilitiesPromise;
|
|
42
|
+
constructor(options: HonuaWmsOptions);
|
|
43
|
+
/** Bind a single named layer for layer-scoped requests. */
|
|
44
|
+
layer(name: string, defaultStyleId?: string): HonuaWmsLayer;
|
|
45
|
+
/** Fetch and parse the service `GetCapabilities` document. */
|
|
46
|
+
capabilities(options?: {
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
}): Promise<WmsCapabilities>;
|
|
49
|
+
/** Render a `GetMap` request across one or more advertised layers. */
|
|
50
|
+
map(request: WmsMapRequest): Promise<HonuaWmsImageResponse>;
|
|
51
|
+
/** Issue a `GetFeatureInfo` against one or more advertised layers. */
|
|
52
|
+
featureInfo<T = Record<string, unknown>>(request: WmsFeatureInfoRequest): Promise<HonuaWmsFeatureInfoResponse<T>>;
|
|
53
|
+
/**
|
|
54
|
+
* Fetch a `GetLegendGraphic` image. Always gates on parsed Capabilities:
|
|
55
|
+
* when the caller does not pre-supply `options.capabilities`, the handle
|
|
56
|
+
* lazily loads them once via `getWmsCapabilities` and caches the
|
|
57
|
+
* promise on the instance so repeat calls reuse the same fetch. Throws
|
|
58
|
+
* `HonuaCapabilityNotSupportedError("legend", "wms", serviceId)` when
|
|
59
|
+
* the service does not advertise `<GetLegendGraphic>`.
|
|
60
|
+
*/
|
|
61
|
+
legend(request: WmsLegendRequest, options?: {
|
|
62
|
+
capabilities?: WmsCapabilities;
|
|
63
|
+
}): Promise<HonuaWmsImageResponse>;
|
|
64
|
+
private loadCachedCapabilities;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Bound layer handle. Drops `layers` / `styles` from per-call requests
|
|
68
|
+
* and pre-fills the LAYER name. `featureInfo()` carries the same `i`,
|
|
69
|
+
* `j`, and `bbox` envelope as the service-level handle.
|
|
70
|
+
*/
|
|
71
|
+
export declare class HonuaWmsLayer {
|
|
72
|
+
readonly client: HonuaClient;
|
|
73
|
+
readonly serviceId: string;
|
|
74
|
+
readonly layerName: string;
|
|
75
|
+
readonly defaultStyleId: string | undefined;
|
|
76
|
+
private capabilitiesPromise;
|
|
77
|
+
constructor(options: HonuaWmsLayerOptions);
|
|
78
|
+
/** Fetch the parent service's `GetCapabilities`. */
|
|
79
|
+
capabilities(options?: {
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
}): Promise<WmsCapabilities>;
|
|
82
|
+
/** Find this layer in a parsed Capabilities document. */
|
|
83
|
+
describe(capabilities: WmsCapabilities): WmsCapabilityLayer | undefined;
|
|
84
|
+
/** Enumerate the styles advertised on this layer. */
|
|
85
|
+
stylesIn(capabilities: WmsCapabilities): readonly WmsCapabilityStyle[];
|
|
86
|
+
map(request: Omit<WmsMapRequest, "layers" | "styles"> & {
|
|
87
|
+
style?: string;
|
|
88
|
+
}): Promise<HonuaWmsImageResponse>;
|
|
89
|
+
featureInfo<T = Record<string, unknown>>(request: Omit<WmsFeatureInfoRequest, "layers" | "queryLayers" | "styles"> & {
|
|
90
|
+
style?: string;
|
|
91
|
+
}): Promise<HonuaWmsFeatureInfoResponse<T>>;
|
|
92
|
+
/**
|
|
93
|
+
* Fetch a `GetLegendGraphic` image scoped to the bound layer + style.
|
|
94
|
+
* Mirrors `HonuaWms.legend`'s gating: when `options.capabilities` is
|
|
95
|
+
* not supplied, the handle lazily loads them once via
|
|
96
|
+
* `getWmsCapabilities` and caches the promise. Throws
|
|
97
|
+
* `HonuaCapabilityNotSupportedError("legend", "wms", serviceId)` when
|
|
98
|
+
* the service does not advertise `<GetLegendGraphic>`.
|
|
99
|
+
*/
|
|
100
|
+
legend(request?: Omit<WmsLegendRequest, "layer" | "style"> & {
|
|
101
|
+
style?: string;
|
|
102
|
+
}, options?: {
|
|
103
|
+
capabilities?: WmsCapabilities;
|
|
104
|
+
}): Promise<HonuaWmsImageResponse>;
|
|
105
|
+
private loadCachedCapabilities;
|
|
106
|
+
}
|
|
107
|
+
export declare function createHonuaWms(client: HonuaClient, serviceId: string): HonuaWms;
|
|
108
|
+
//# sourceMappingURL=wms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wms.d.ts","sourceRoot":"","sources":["../../../src/core/wms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErG,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM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` is the bound
|
|
4
|
+
* handle returned by `HonuaWms.layer(name)` that pre-fills the LAYER and
|
|
5
|
+
* default STYLE so per-call envelopes can drop the routing fields.
|
|
6
|
+
*
|
|
7
|
+
* Wire transport lives on `HonuaClient` (`getWmsCapabilities`,
|
|
8
|
+
* `getWmsMap`, `getWmsFeatureInfo`, `getWmsLegend`); this class is the
|
|
9
|
+
* typed surface consumers reach through `Source.protocol("wms")`.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { HonuaCapabilityNotSupportedError } from "./errors.js";
|
|
14
|
+
import { findWmsLayer } from "./wms-capabilities.js";
|
|
15
|
+
/**
|
|
16
|
+
* Split a WMS `LAYERS=` value (or `locator.typeName` / `spec.layers` of
|
|
17
|
+
* the same shape) into the list of non-empty trimmed layer tokens. Used
|
|
18
|
+
* by the contract WMS adapter and shared style resolver so the
|
|
19
|
+
* single-layer handle rule stays in one place.
|
|
20
|
+
*/
|
|
21
|
+
export function parseWmsLayerNames(value) {
|
|
22
|
+
if (typeof value !== "string" || value.length === 0)
|
|
23
|
+
return [];
|
|
24
|
+
return value
|
|
25
|
+
.split(",")
|
|
26
|
+
.map((s) => s.trim())
|
|
27
|
+
.filter((s) => s.length > 0);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Service-level WMS handle. Use `layer(name)` to bind a single LAYER and
|
|
31
|
+
* style; for multi-layer composites (`LAYERS=a,b,c`) call `map()` /
|
|
32
|
+
* `featureInfo()` directly on this handle.
|
|
33
|
+
*/
|
|
34
|
+
export class HonuaWms {
|
|
35
|
+
client;
|
|
36
|
+
serviceId;
|
|
37
|
+
capabilitiesPromise;
|
|
38
|
+
constructor(options) {
|
|
39
|
+
this.client = options.client;
|
|
40
|
+
this.serviceId = options.serviceId;
|
|
41
|
+
}
|
|
42
|
+
/** Bind a single named layer for layer-scoped requests. */
|
|
43
|
+
layer(name, defaultStyleId) {
|
|
44
|
+
const opts = {
|
|
45
|
+
client: this.client,
|
|
46
|
+
serviceId: this.serviceId,
|
|
47
|
+
layerName: name,
|
|
48
|
+
};
|
|
49
|
+
if (defaultStyleId !== undefined)
|
|
50
|
+
opts.defaultStyleId = defaultStyleId;
|
|
51
|
+
return new HonuaWmsLayer(opts);
|
|
52
|
+
}
|
|
53
|
+
/** Fetch and parse the service `GetCapabilities` document. */
|
|
54
|
+
async capabilities(options) {
|
|
55
|
+
return this.client.getWmsCapabilities({
|
|
56
|
+
serviceId: this.serviceId,
|
|
57
|
+
...(options?.signal ? { signal: options.signal } : {}),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Render a `GetMap` request across one or more advertised layers. */
|
|
61
|
+
async map(request) {
|
|
62
|
+
return this.client.getWmsMap({ serviceId: this.serviceId, ...request });
|
|
63
|
+
}
|
|
64
|
+
/** Issue a `GetFeatureInfo` against one or more advertised layers. */
|
|
65
|
+
async featureInfo(request) {
|
|
66
|
+
return this.client.getWmsFeatureInfo({ serviceId: this.serviceId, ...request });
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fetch a `GetLegendGraphic` image. Always gates on parsed Capabilities:
|
|
70
|
+
* when the caller does not pre-supply `options.capabilities`, the handle
|
|
71
|
+
* lazily loads them once via `getWmsCapabilities` and caches the
|
|
72
|
+
* promise on the instance so repeat calls reuse the same fetch. Throws
|
|
73
|
+
* `HonuaCapabilityNotSupportedError("legend", "wms", serviceId)` when
|
|
74
|
+
* the service does not advertise `<GetLegendGraphic>`.
|
|
75
|
+
*/
|
|
76
|
+
async legend(request, options) {
|
|
77
|
+
const caps = options?.capabilities ?? (await this.loadCachedCapabilities());
|
|
78
|
+
if (!caps.request.getLegendGraphic) {
|
|
79
|
+
throw new HonuaCapabilityNotSupportedError("legend", "wms", this.serviceId);
|
|
80
|
+
}
|
|
81
|
+
return this.client.getWmsLegend({ serviceId: this.serviceId, ...request });
|
|
82
|
+
}
|
|
83
|
+
async loadCachedCapabilities() {
|
|
84
|
+
if (!this.capabilitiesPromise) {
|
|
85
|
+
this.capabilitiesPromise = this.capabilities().catch((error) => {
|
|
86
|
+
// Drop the cached promise on failure so the next call retries
|
|
87
|
+
// instead of permanently surfacing the same error.
|
|
88
|
+
this.capabilitiesPromise = undefined;
|
|
89
|
+
throw error;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return this.capabilitiesPromise;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Bound layer handle. Drops `layers` / `styles` from per-call requests
|
|
97
|
+
* and pre-fills the LAYER name. `featureInfo()` carries the same `i`,
|
|
98
|
+
* `j`, and `bbox` envelope as the service-level handle.
|
|
99
|
+
*/
|
|
100
|
+
export class HonuaWmsLayer {
|
|
101
|
+
client;
|
|
102
|
+
serviceId;
|
|
103
|
+
layerName;
|
|
104
|
+
defaultStyleId;
|
|
105
|
+
capabilitiesPromise;
|
|
106
|
+
constructor(options) {
|
|
107
|
+
this.client = options.client;
|
|
108
|
+
this.serviceId = options.serviceId;
|
|
109
|
+
this.layerName = options.layerName;
|
|
110
|
+
this.defaultStyleId = options.defaultStyleId;
|
|
111
|
+
}
|
|
112
|
+
/** Fetch the parent service's `GetCapabilities`. */
|
|
113
|
+
async capabilities(options) {
|
|
114
|
+
return this.client.getWmsCapabilities({
|
|
115
|
+
serviceId: this.serviceId,
|
|
116
|
+
...(options?.signal ? { signal: options.signal } : {}),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Find this layer in a parsed Capabilities document. */
|
|
120
|
+
describe(capabilities) {
|
|
121
|
+
return findWmsLayer(capabilities, this.layerName);
|
|
122
|
+
}
|
|
123
|
+
/** Enumerate the styles advertised on this layer. */
|
|
124
|
+
stylesIn(capabilities) {
|
|
125
|
+
return this.describe(capabilities)?.styles ?? [];
|
|
126
|
+
}
|
|
127
|
+
async map(request) {
|
|
128
|
+
const { style, ...rest } = request;
|
|
129
|
+
const styleId = style ?? this.defaultStyleId;
|
|
130
|
+
return this.client.getWmsMap({
|
|
131
|
+
serviceId: this.serviceId,
|
|
132
|
+
layers: [this.layerName],
|
|
133
|
+
...(styleId !== undefined ? { styles: [styleId] } : {}),
|
|
134
|
+
...rest,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
async featureInfo(request) {
|
|
138
|
+
const { style, ...rest } = request;
|
|
139
|
+
const styleId = style ?? this.defaultStyleId;
|
|
140
|
+
return this.client.getWmsFeatureInfo({
|
|
141
|
+
serviceId: this.serviceId,
|
|
142
|
+
layers: [this.layerName],
|
|
143
|
+
queryLayers: [this.layerName],
|
|
144
|
+
...(styleId !== undefined ? { styles: [styleId] } : {}),
|
|
145
|
+
...rest,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Fetch a `GetLegendGraphic` image scoped to the bound layer + style.
|
|
150
|
+
* Mirrors `HonuaWms.legend`'s gating: when `options.capabilities` is
|
|
151
|
+
* not supplied, the handle lazily loads them once via
|
|
152
|
+
* `getWmsCapabilities` and caches the promise. Throws
|
|
153
|
+
* `HonuaCapabilityNotSupportedError("legend", "wms", serviceId)` when
|
|
154
|
+
* the service does not advertise `<GetLegendGraphic>`.
|
|
155
|
+
*/
|
|
156
|
+
async legend(request = {}, options) {
|
|
157
|
+
const caps = options?.capabilities ?? (await this.loadCachedCapabilities());
|
|
158
|
+
if (!caps.request.getLegendGraphic) {
|
|
159
|
+
throw new HonuaCapabilityNotSupportedError("legend", "wms", this.serviceId);
|
|
160
|
+
}
|
|
161
|
+
const { style, ...rest } = request;
|
|
162
|
+
const styleId = style ?? this.defaultStyleId;
|
|
163
|
+
return this.client.getWmsLegend({
|
|
164
|
+
serviceId: this.serviceId,
|
|
165
|
+
layer: this.layerName,
|
|
166
|
+
...(styleId !== undefined ? { style: styleId } : {}),
|
|
167
|
+
...rest,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async loadCachedCapabilities() {
|
|
171
|
+
if (!this.capabilitiesPromise) {
|
|
172
|
+
this.capabilitiesPromise = this.capabilities().catch((error) => {
|
|
173
|
+
this.capabilitiesPromise = undefined;
|
|
174
|
+
throw error;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return this.capabilitiesPromise;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export function createHonuaWms(client, serviceId) {
|
|
181
|
+
return new HonuaWms({ client, serviceId });
|
|
182
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WMTS 1.0.0 Capabilities parser. Hand-rolled, narrow-scope walker over
|
|
3
|
+
* the `Capabilities` document advertised by honua-server (single
|
|
4
|
+
* advertised TileMatrixSet today: `WebMercatorQuad`). Yields a typed
|
|
5
|
+
* `WmtsCapabilities` shape so the SDK can route through the canonical
|
|
6
|
+
* `Source` surface without leaking XML.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Top-level WMTS Capabilities surface.
|
|
12
|
+
*/
|
|
13
|
+
export interface WmtsCapabilities {
|
|
14
|
+
/** Protocol version. honua-server advertises `1.0.0`. */
|
|
15
|
+
version: string;
|
|
16
|
+
service: WmtsCapabilitiesService;
|
|
17
|
+
layers: ReadonlyArray<WmtsCapabilityLayer>;
|
|
18
|
+
tileMatrixSets: ReadonlyArray<WmtsCapabilityTileMatrixSet>;
|
|
19
|
+
}
|
|
20
|
+
export interface WmtsCapabilitiesService {
|
|
21
|
+
title?: string;
|
|
22
|
+
abstract?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WmtsCapabilityLayer {
|
|
25
|
+
identifier: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
abstract?: string;
|
|
28
|
+
formats: readonly string[];
|
|
29
|
+
styles: ReadonlyArray<WmtsCapabilityStyle>;
|
|
30
|
+
/** TileMatrixSet identifiers the layer supports. */
|
|
31
|
+
tileMatrixSetIds: readonly string[];
|
|
32
|
+
/** RESTful tile templates (xlink:href) advertised by `ResourceURL@resourceType="tile"`. */
|
|
33
|
+
resourceTemplates: ReadonlyArray<WmtsCapabilityResourceUrl>;
|
|
34
|
+
/** RESTful FeatureInfo templates advertised by `ResourceURL@resourceType="FeatureInfo"`. */
|
|
35
|
+
featureInfoTemplates: ReadonlyArray<WmtsCapabilityResourceUrl>;
|
|
36
|
+
/** Geographic bounding box (WGS84) when advertised. */
|
|
37
|
+
bbox?: {
|
|
38
|
+
west: number;
|
|
39
|
+
south: number;
|
|
40
|
+
east: number;
|
|
41
|
+
north: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface WmtsCapabilityStyle {
|
|
45
|
+
identifier: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
isDefault: boolean;
|
|
48
|
+
legendUrl?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface WmtsCapabilityResourceUrl {
|
|
51
|
+
format: string;
|
|
52
|
+
template: string;
|
|
53
|
+
}
|
|
54
|
+
export interface WmtsCapabilityTileMatrixSet {
|
|
55
|
+
identifier: string;
|
|
56
|
+
/** CRS supportedCRS or wellKnownScaleSet href when advertised. */
|
|
57
|
+
supportedCrs?: string;
|
|
58
|
+
wellKnownScaleSet?: string;
|
|
59
|
+
matrices: ReadonlyArray<WmtsCapabilityTileMatrix>;
|
|
60
|
+
}
|
|
61
|
+
export interface WmtsCapabilityTileMatrix {
|
|
62
|
+
identifier: string;
|
|
63
|
+
scaleDenominator: number;
|
|
64
|
+
matrixWidth: number;
|
|
65
|
+
matrixHeight: number;
|
|
66
|
+
tileWidth: number;
|
|
67
|
+
tileHeight: number;
|
|
68
|
+
topLeftCorner: readonly [number, number];
|
|
69
|
+
}
|
|
70
|
+
export declare class HonuaWmtsCapabilitiesParseError extends Error {
|
|
71
|
+
constructor(message: string);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Parse a `Capabilities` text body for WMTS 1.0 into the typed
|
|
75
|
+
* `WmtsCapabilities` shape.
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseWmtsCapabilities(xml: string): WmtsCapabilities;
|
|
78
|
+
/** Find a layer by identifier in a parsed `WmtsCapabilities`. */
|
|
79
|
+
export declare function findWmtsLayer(capabilities: WmtsCapabilities, identifier: string): WmtsCapabilityLayer | undefined;
|
|
80
|
+
/** Find a tile-matrix-set by identifier. */
|
|
81
|
+
export declare function findWmtsTileMatrixSet(capabilities: WmtsCapabilities, identifier: string): WmtsCapabilityTileMatrixSet | undefined;
|
|
82
|
+
//# sourceMappingURL=wmts-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wmts-capabilities.d.ts","sourceRoot":"","sources":["../../../src/core/wmts-capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC3C,cAAc,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC3C,oDAAoD;IACpD,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,2FAA2F;IAC3F,iBAAiB,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC5D,4FAA4F;IAC5F,oBAAoB,EAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAC/D,uDAAuD;IACv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