@loaders.gl/wms 3.3.0-alpha.12 → 3.3.0-alpha.13
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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +6 -0
- package/dist/dist.min.js +4842 -5361
- package/dist/es5/index.js +41 -20
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +74 -0
- package/dist/es5/lerc-loader.js.map +1 -0
- package/dist/es5/lib/data-sources/adhoc-image-service.js +125 -0
- package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/image-source.js +14 -0
- package/dist/es5/lib/data-sources/image-source.js.map +1 -0
- package/dist/es5/lib/data-sources/wms-service.js +192 -173
- package/dist/es5/lib/data-sources/wms-service.js.map +1 -1
- package/dist/es5/lib/gml/deep-strict-equal.js +64 -0
- package/dist/es5/lib/gml/deep-strict-equal.js.map +1 -0
- package/dist/es5/lib/gml/parse-gml.js +3 -3
- package/dist/es5/lib/gml/parse-gml.js.map +1 -1
- package/dist/es5/lib/lerc/lerc-types.js +2 -0
- package/dist/es5/lib/lerc/lerc-types.js.map +1 -0
- package/dist/es5/lib/wcs/parse-wcs.js +43 -0
- package/dist/es5/lib/wcs/parse-wcs.js.map +1 -0
- package/dist/es5/lib/wcs/wcs-types.js +2 -0
- package/dist/es5/lib/wcs/wcs-types.js.map +1 -0
- package/dist/es5/lib/wms/parse-wms.js +6 -4
- package/dist/es5/lib/wms/parse-wms.js.map +1 -1
- package/dist/es5/wip/data-source.js +4 -0
- package/dist/es5/wip/data-source.js.map +1 -0
- package/dist/es5/{gml-loader.js → wip/gml-loader.js} +2 -2
- package/dist/es5/wip/gml-loader.js.map +1 -0
- package/dist/es5/{wcs-capabilities-loader.js → wip/wcs-capabilities-loader.js} +5 -5
- package/dist/es5/wip/wcs-capabilities-loader.js.map +1 -0
- package/dist/es5/{wfs-capabilities-loader.js → wip/wfs-capabilities-loader.js} +3 -3
- package/dist/es5/wip/wfs-capabilities-loader.js.map +1 -0
- package/dist/es5/{wms-feature-info-loader.js → wip/wms-feature-info-loader.js} +3 -3
- package/dist/es5/wip/wms-feature-info-loader.js.map +1 -0
- package/dist/es5/{wms-layer-description-loader.js → wip/wms-layer-description-loader.js} +3 -3
- package/dist/es5/wip/wms-layer-description-loader.js.map +1 -0
- package/dist/es5/wip/wms-layer-description-loader.md +47 -0
- package/dist/es5/{wmts-capabilities-loader.js → wip/wmts-capabilities-loader.js} +3 -3
- package/dist/es5/wip/wmts-capabilities-loader.js.map +1 -0
- package/dist/es5/wms-capabilities-loader.js +2 -2
- package/dist/es5/wms-capabilities-loader.js.map +1 -1
- package/dist/es5/wms-error-loader.js +22 -6
- package/dist/es5/wms-error-loader.js.map +1 -1
- package/dist/esm/index.js +11 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +25 -0
- package/dist/esm/lerc-loader.js.map +1 -0
- package/dist/esm/lib/data-sources/adhoc-image-service.js +41 -0
- package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/image-source.js +4 -0
- package/dist/esm/lib/data-sources/image-source.js.map +1 -0
- package/dist/esm/lib/data-sources/wms-service.js +136 -116
- package/dist/esm/lib/data-sources/wms-service.js.map +1 -1
- package/dist/esm/lib/gml/deep-strict-equal.js +57 -0
- package/dist/esm/lib/gml/deep-strict-equal.js.map +1 -0
- package/dist/esm/lib/gml/parse-gml.js +1 -1
- package/dist/esm/lib/gml/parse-gml.js.map +1 -1
- package/dist/esm/lib/lerc/lerc-types.js +2 -0
- package/dist/esm/lib/lerc/lerc-types.js.map +1 -0
- package/dist/esm/lib/wcs/parse-wcs.js +32 -0
- package/dist/esm/lib/wcs/parse-wcs.js.map +1 -0
- package/dist/esm/lib/wcs/wcs-types.js +2 -0
- package/dist/esm/lib/wcs/wcs-types.js.map +1 -0
- package/dist/esm/lib/wms/parse-wms.js +6 -4
- package/dist/esm/lib/wms/parse-wms.js.map +1 -1
- package/dist/esm/wip/data-source.js +2 -0
- package/dist/esm/wip/data-source.js.map +1 -0
- package/dist/esm/{gml-loader.js → wip/gml-loader.js} +2 -2
- package/dist/esm/wip/gml-loader.js.map +1 -0
- package/dist/esm/{wcs-capabilities-loader.js → wip/wcs-capabilities-loader.js} +3 -3
- package/dist/esm/wip/wcs-capabilities-loader.js.map +1 -0
- package/dist/esm/{wfs-capabilities-loader.js → wip/wfs-capabilities-loader.js} +3 -3
- package/dist/esm/wip/wfs-capabilities-loader.js.map +1 -0
- package/dist/esm/{wms-feature-info-loader.js → wip/wms-feature-info-loader.js} +3 -3
- package/dist/esm/wip/wms-feature-info-loader.js.map +1 -0
- package/dist/esm/{wms-layer-description-loader.js → wip/wms-layer-description-loader.js} +3 -3
- package/dist/esm/wip/wms-layer-description-loader.js.map +1 -0
- package/dist/esm/wip/wms-layer-description-loader.md +47 -0
- package/dist/esm/{wmts-capabilities-loader.js → wip/wmts-capabilities-loader.js} +3 -3
- package/dist/esm/wip/wmts-capabilities-loader.js.map +1 -0
- package/dist/esm/wms-capabilities-loader.js +2 -2
- package/dist/esm/wms-capabilities-loader.js.map +1 -1
- package/dist/esm/wms-error-loader.js +20 -5
- package/dist/esm/wms-error-loader.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/lerc-loader.d.ts +30 -0
- package/dist/lerc-loader.d.ts.map +1 -0
- package/dist/lerc-loader.js +56 -0
- package/dist/lib/data-sources/adhoc-image-service.d.ts +22 -0
- package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/adhoc-image-service.js +44 -0
- package/dist/lib/data-sources/image-source.d.ts +73 -0
- package/dist/lib/data-sources/image-source.d.ts.map +1 -0
- package/dist/lib/data-sources/image-source.js +12 -0
- package/dist/lib/data-sources/wms-service.d.ts +193 -0
- package/dist/lib/data-sources/wms-service.d.ts.map +1 -0
- package/dist/lib/data-sources/wms-service.js +206 -0
- package/dist/lib/gml/deep-strict-equal.d.ts +3 -0
- package/dist/lib/gml/deep-strict-equal.d.ts.map +1 -0
- package/dist/lib/gml/deep-strict-equal.js +119 -0
- package/dist/lib/gml/parse-gml.d.ts +28 -0
- package/dist/lib/gml/parse-gml.d.ts.map +1 -0
- package/dist/lib/gml/parse-gml.js +371 -0
- package/dist/lib/lerc/lerc-types.d.ts +30 -0
- package/dist/lib/lerc/lerc-types.d.ts.map +1 -0
- package/dist/lib/lerc/lerc-types.js +3 -0
- package/dist/lib/wcs/parse-wcs.d.ts +7 -0
- package/dist/lib/wcs/parse-wcs.d.ts.map +1 -0
- package/dist/lib/wcs/parse-wcs.js +36 -0
- package/dist/lib/wcs/wcs-types.d.ts +73 -0
- package/dist/lib/wcs/wcs-types.d.ts.map +1 -0
- package/dist/lib/wcs/wcs-types.js +3 -0
- package/dist/lib/wfs/parse-wfs.d.ts +7 -0
- package/dist/lib/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/lib/wfs/parse-wfs.js +36 -0
- package/dist/lib/wfs/wfs-types.d.ts +73 -0
- package/dist/lib/wfs/wfs-types.d.ts.map +1 -0
- package/dist/lib/wfs/wfs-types.js +3 -0
- package/dist/lib/wms/parse-wms.d.ts +24 -0
- package/dist/lib/wms/parse-wms.d.ts.map +1 -0
- package/dist/lib/wms/parse-wms.js +115 -0
- package/dist/lib/wms/wms-types.d.ts +100 -0
- package/dist/lib/wms/wms-types.d.ts.map +1 -0
- package/dist/lib/wms/wms-types.js +1908 -0
- package/dist/lib/wmts/parse-wmts.d.ts +7 -0
- package/dist/lib/wmts/parse-wmts.d.ts.map +1 -0
- package/dist/lib/wmts/parse-wmts.js +36 -0
- package/dist/lib/wmts/wmts-types.d.ts +73 -0
- package/dist/lib/wmts/wmts-types.d.ts.map +1 -0
- package/dist/lib/wmts/wmts-types.js +3 -0
- package/dist/wip/data-source.d.ts +53 -0
- package/dist/wip/data-source.d.ts.map +1 -0
- package/dist/wip/data-source.js +57 -0
- package/dist/wip/gml-loader.d.ts +26 -0
- package/dist/wip/gml-loader.d.ts.map +1 -0
- package/dist/wip/gml-loader.js +31 -0
- package/dist/wip/wcs-capabilities-loader.d.ts +26 -0
- package/dist/wip/wcs-capabilities-loader.d.ts.map +1 -0
- package/dist/wip/wcs-capabilities-loader.js +31 -0
- package/dist/wip/wfs-capabilities-loader.d.ts +26 -0
- package/dist/wip/wfs-capabilities-loader.d.ts.map +1 -0
- package/dist/wip/wfs-capabilities-loader.js +31 -0
- package/dist/wip/wms-feature-info-loader.d.ts +22 -0
- package/dist/wip/wms-feature-info-loader.d.ts.map +1 -0
- package/dist/wip/wms-feature-info-loader.js +17 -0
- package/dist/wip/wms-layer-description-loader.d.ts +22 -0
- package/dist/wip/wms-layer-description-loader.d.ts.map +1 -0
- package/dist/wip/wms-layer-description-loader.js +17 -0
- package/dist/wip/wmts-capabilities-loader.d.ts +26 -0
- package/dist/wip/wmts-capabilities-loader.d.ts.map +1 -0
- package/dist/wip/wmts-capabilities-loader.js +31 -0
- package/dist/wms-capabilities-loader.d.ts +26 -0
- package/dist/wms-capabilities-loader.d.ts.map +1 -0
- package/dist/wms-capabilities-loader.js +31 -0
- package/dist/wms-error-loader.d.ts +34 -0
- package/dist/wms-error-loader.d.ts.map +1 -0
- package/dist/wms-error-loader.js +43 -0
- package/package.json +9 -8
- package/src/index.ts +34 -13
- package/src/lerc-loader.ts +50 -0
- package/src/lib/data-sources/adhoc-image-service.ts +58 -0
- package/src/lib/data-sources/image-source.ts +82 -0
- package/src/lib/data-sources/wms-service.ts +211 -177
- package/src/lib/gml/deep-strict-equal.ts +119 -0
- package/src/lib/gml/parse-gml.ts +1 -1
- package/src/lib/lerc/lerc-types.ts +43 -0
- package/src/lib/wcs/parse-wcs.ts +39 -0
- package/src/lib/wcs/wcs-types.ts +77 -0
- package/src/lib/wms/parse-wms.ts +16 -3
- package/src/{lib/data-sources/image-data-source.ts → wip/data-source.ts} +6 -29
- package/src/{gml-loader.ts → wip/gml-loader.ts} +1 -1
- package/src/{wcs-capabilities-loader.ts → wip/wcs-capabilities-loader.ts} +2 -2
- package/src/{wfs-capabilities-loader.ts → wip/wfs-capabilities-loader.ts} +2 -2
- package/src/{wms-feature-info-loader.ts → wip/wms-feature-info-loader.ts} +3 -3
- package/src/wip/wms-layer-description-loader.md +47 -0
- package/src/{wms-layer-description-loader.ts → wip/wms-layer-description-loader.ts} +3 -3
- package/src/{wmts-capabilities-loader.ts → wip/wmts-capabilities-loader.ts} +2 -2
- package/src/wms-capabilities-loader.ts +1 -1
- package/src/wms-error-loader.ts +25 -6
- package/dist/es5/gml-loader.js.map +0 -1
- package/dist/es5/lib/data-sources/image-data-source.js +0 -4
- package/dist/es5/lib/data-sources/image-data-source.js.map +0 -1
- package/dist/es5/wcs-capabilities-loader.js.map +0 -1
- package/dist/es5/wfs-capabilities-loader.js.map +0 -1
- package/dist/es5/wms-feature-info-loader.js.map +0 -1
- package/dist/es5/wms-layer-description-loader.js.map +0 -1
- package/dist/es5/wmts-capabilities-loader.js.map +0 -1
- package/dist/esm/gml-loader.js.map +0 -1
- package/dist/esm/lib/data-sources/image-data-source.js +0 -2
- package/dist/esm/lib/data-sources/image-data-source.js.map +0 -1
- package/dist/esm/wcs-capabilities-loader.js.map +0 -1
- package/dist/esm/wfs-capabilities-loader.js.map +0 -1
- package/dist/esm/wms-feature-info-loader.js.map +0 -1
- package/dist/esm/wms-layer-description-loader.js.map +0 -1
- package/dist/esm/wmts-capabilities-loader.js.map +0 -1
|
@@ -2,36 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
WMSCapabilitiesLoader,
|
|
8
|
-
WMSFeatureInfoLoader,
|
|
9
|
-
WMSLayerDescriptionLoader,
|
|
10
|
-
WMSErrorLoader
|
|
11
|
-
} from '@loaders.gl/wms';
|
|
12
|
-
import {ImageLoader, ImageType} from '@loaders.gl/images';
|
|
5
|
+
import type {ImageType} from '@loaders.gl/images';
|
|
6
|
+
import {ImageLoader} from '@loaders.gl/images';
|
|
13
7
|
import {LoaderOptions} from '@loaders.gl/loader-utils';
|
|
14
8
|
|
|
9
|
+
import type {ImageSourceMetadata, GetImageParameters} from './image-source';
|
|
10
|
+
import {ImageSource} from './image-source';
|
|
11
|
+
|
|
12
|
+
import type {WMSCapabilities, WMSFeatureInfo, WMSLayerDescription} from '../wms/wms-types';
|
|
13
|
+
import {WMSCapabilitiesLoader} from '../../wms-capabilities-loader';
|
|
14
|
+
import {WMSFeatureInfoLoader} from '../../wip/wms-feature-info-loader';
|
|
15
|
+
import {WMSLayerDescriptionLoader} from '../../wip/wms-layer-description-loader';
|
|
16
|
+
import {WMSErrorLoader} from '../../wms-error-loader';
|
|
17
|
+
|
|
15
18
|
type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
type WMSCommonParameters = {
|
|
18
21
|
/** In case the endpoint supports multiple services */
|
|
19
22
|
service?: 'WMS';
|
|
20
23
|
/** In case the endpoint supports multiple WMS versions */
|
|
21
24
|
version?: '1.1.1' | '1.3.0';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type WMSGetCapabilitiesParameters = WMSCommonParameters & {
|
|
22
28
|
/** Request type */
|
|
23
29
|
request?: 'GetCapabilities';
|
|
24
30
|
};
|
|
25
31
|
|
|
26
|
-
export type WMSGetMapParameters = {
|
|
27
|
-
/** In case the endpoint supports multiple services */
|
|
28
|
-
service?: 'WMS';
|
|
29
|
-
/** In case the endpoint supports multiple WMS versions */
|
|
30
|
-
version?: '1.1.1' | '1.3.0';
|
|
32
|
+
export type WMSGetMapParameters = WMSCommonParameters & {
|
|
31
33
|
/** Request type */
|
|
32
34
|
request?: 'GetMap';
|
|
33
35
|
/** Layers to render */
|
|
34
|
-
layers: string[];
|
|
36
|
+
layers: string | string[];
|
|
35
37
|
/** Styling */
|
|
36
38
|
styles?: unknown;
|
|
37
39
|
/** bounding box of the requested map image */
|
|
@@ -47,11 +49,7 @@ export type WMSGetMapParameters = {
|
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
// https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&
|
|
50
|
-
export type WMSGetFeatureInfoParameters = {
|
|
51
|
-
/** In case the endpoint supports multiple services */
|
|
52
|
-
service?: 'WMS';
|
|
53
|
-
/** In case the endpoint supports multiple WMS versions */
|
|
54
|
-
version?: '1.1.1' | '1.3.0';
|
|
52
|
+
export type WMSGetFeatureInfoParameters = WMSCommonParameters & {
|
|
55
53
|
/** Request type */
|
|
56
54
|
request?: 'GetFeatureInfo';
|
|
57
55
|
|
|
@@ -62,7 +60,7 @@ export type WMSGetFeatureInfoParameters = {
|
|
|
62
60
|
/** list of layers to query (could be different from rendered layers) */
|
|
63
61
|
query_layers: string[];
|
|
64
62
|
/** MIME type of returned feature info */
|
|
65
|
-
info_format
|
|
63
|
+
info_format?: 'text/plain';
|
|
66
64
|
|
|
67
65
|
/** Layers to render */
|
|
68
66
|
layers: string[];
|
|
@@ -80,234 +78,270 @@ export type WMSGetFeatureInfoParameters = {
|
|
|
80
78
|
format?: 'image/png';
|
|
81
79
|
};
|
|
82
80
|
|
|
83
|
-
export type WMSDescribeLayerParameters = {
|
|
84
|
-
/** In case the endpoint supports multiple services */
|
|
85
|
-
service?: 'WMS';
|
|
86
|
-
/** In case the endpoint supports multiple WMS versions */
|
|
87
|
-
version?: '1.1.1' | '1.3.0';
|
|
81
|
+
export type WMSDescribeLayerParameters = WMSCommonParameters & {
|
|
88
82
|
/** Request type */
|
|
89
83
|
request?: 'DescribeLayer';
|
|
90
84
|
};
|
|
91
85
|
|
|
92
|
-
export type WMSGetLegendGraphicParameters = {
|
|
93
|
-
/** In case the endpoint supports multiple services */
|
|
94
|
-
service?: 'WMS';
|
|
95
|
-
/** In case the endpoint supports multiple WMS versions */
|
|
96
|
-
version?: '1.1.1' | '1.3.0';
|
|
86
|
+
export type WMSGetLegendGraphicParameters = WMSCommonParameters & {
|
|
97
87
|
/** Request type */
|
|
98
88
|
request?: 'GetLegendGraphic';
|
|
99
89
|
};
|
|
100
90
|
|
|
101
|
-
|
|
102
|
-
service: 'WMS',
|
|
103
|
-
version: '1.1.1',
|
|
104
|
-
request: 'GetCapabilities'
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const WMS_GET_MAP_DEFAULT_PARAMETERS: Required<WMSGetMapParameters> = {
|
|
108
|
-
service: 'WMS',
|
|
109
|
-
version: '1.1.1',
|
|
110
|
-
request: 'GetMap',
|
|
111
|
-
layers: [],
|
|
112
|
-
styles: undefined,
|
|
113
|
-
bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
114
|
-
width: 1200,
|
|
115
|
-
height: 900,
|
|
116
|
-
srs: 'EPSG:4326',
|
|
117
|
-
format: 'image/png'
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const WMS_GET_FEATURE_INFO_DEFAULT_PARAMETERS: Required<WMSGetFeatureInfoParameters> = {
|
|
121
|
-
service: 'WMS',
|
|
122
|
-
version: '1.1.1',
|
|
123
|
-
request: 'GetFeatureInfo',
|
|
124
|
-
layers: [],
|
|
125
|
-
styles: undefined,
|
|
126
|
-
bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
127
|
-
width: 1200,
|
|
128
|
-
height: 900,
|
|
129
|
-
srs: 'EPSG:4326',
|
|
130
|
-
format: 'image/png',
|
|
131
|
-
|
|
132
|
-
x: undefined!,
|
|
133
|
-
y: undefined!,
|
|
134
|
-
query_layers: [],
|
|
135
|
-
info_format: 'text/plain'
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const WMS_DESCRIBE_LAYER_DEFAULT_PARAMETERS: Required<WMSDescribeLayerParameters> = {
|
|
139
|
-
service: 'WMS',
|
|
140
|
-
version: '1.1.1',
|
|
141
|
-
request: 'DescribeLayer'
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const WMS_GET_LEGEND_GRAPHIC_DEFAULT_PARAMETERS: Required<WMSGetLegendGraphicParameters> = {
|
|
145
|
-
service: 'WMS',
|
|
146
|
-
version: '1.1.1',
|
|
147
|
-
request: 'GetLegendGraphic'
|
|
148
|
-
};
|
|
149
|
-
|
|
91
|
+
/** Properties that can be specified when creating a new WMS service */
|
|
150
92
|
export type WMSServiceProps = {
|
|
151
|
-
|
|
93
|
+
/** Base URL to the service */
|
|
94
|
+
serviceUrl: string;
|
|
95
|
+
/** Any load options to the loaders.gl Loaders used by the WMSService methods */
|
|
152
96
|
loadOptions?: LoaderOptions;
|
|
97
|
+
/** Override the fetch function if required */
|
|
153
98
|
fetch?: typeof fetch | FetchLike;
|
|
154
99
|
};
|
|
155
100
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The WMSService class provides
|
|
103
|
+
* - provides type safe methods to form URLs to a WMS service
|
|
104
|
+
* - provides type safe methods to query and parse results (and errors) from a WMS service
|
|
105
|
+
* - implements the ImageService interface
|
|
106
|
+
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
107
|
+
*/
|
|
108
|
+
export class WMSService extends ImageSource {
|
|
109
|
+
serviceUrl: string;
|
|
110
|
+
loadOptions: LoaderOptions = {
|
|
111
|
+
// We want error responses to throw exceptions, the WMSErrorLoader can do this
|
|
112
|
+
wms: {throwOnError: true}
|
|
113
|
+
};
|
|
159
114
|
fetch: typeof fetch | FetchLike;
|
|
160
115
|
|
|
116
|
+
/** A list of loaders used by the WMSService methods */
|
|
117
|
+
readonly loaders = [
|
|
118
|
+
ImageLoader,
|
|
119
|
+
WMSErrorLoader,
|
|
120
|
+
WMSCapabilitiesLoader,
|
|
121
|
+
WMSFeatureInfoLoader,
|
|
122
|
+
WMSLayerDescriptionLoader
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
/** Create a WMSService */
|
|
161
126
|
constructor(props: WMSServiceProps) {
|
|
162
|
-
|
|
163
|
-
this.
|
|
127
|
+
super();
|
|
128
|
+
this.serviceUrl = props.serviceUrl;
|
|
129
|
+
// TODO Need an options merge function from loaders.gl to merge subobjects
|
|
130
|
+
Object.assign(this.loadOptions, props.loadOptions);
|
|
164
131
|
this.fetch = props.fetch || fetch;
|
|
165
132
|
}
|
|
166
133
|
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
parameters?: WMSGetCapabilitiesParameters,
|
|
171
|
-
extra?: Record<string, unknown>
|
|
172
|
-
): string {
|
|
173
|
-
const options: Required<WMSGetCapabilitiesParameters> = {
|
|
174
|
-
...WMS_GET_CAPABILITIES_DEFAULT_PARAMETERS,
|
|
175
|
-
...parameters,
|
|
176
|
-
...extra
|
|
177
|
-
};
|
|
178
|
-
return this.getWMSUrl(options, extra);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
getMapURL(parameters: WMSGetMapParameters, extra?: Record<string, unknown>): string {
|
|
182
|
-
const options: Required<WMSGetMapParameters> = {
|
|
183
|
-
...WMS_GET_MAP_DEFAULT_PARAMETERS,
|
|
184
|
-
...parameters,
|
|
185
|
-
...extra
|
|
186
|
-
};
|
|
187
|
-
return this.getWMSUrl(options, extra);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
getFeatureInfoURL(
|
|
191
|
-
parameters: WMSGetFeatureInfoParameters,
|
|
192
|
-
extra?: Record<string, unknown>
|
|
193
|
-
): string {
|
|
194
|
-
const options: Required<WMSGetFeatureInfoParameters> = {
|
|
195
|
-
...WMS_GET_FEATURE_INFO_DEFAULT_PARAMETERS,
|
|
196
|
-
...parameters,
|
|
197
|
-
...extra
|
|
198
|
-
};
|
|
199
|
-
return this.getWMSUrl(options, extra);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
describeLayerURL(
|
|
203
|
-
parameters: WMSDescribeLayerParameters,
|
|
204
|
-
extra?: Record<string, unknown>
|
|
205
|
-
): string {
|
|
206
|
-
const options: Required<WMSDescribeLayerParameters> = {
|
|
207
|
-
...WMS_DESCRIBE_LAYER_DEFAULT_PARAMETERS,
|
|
208
|
-
...parameters,
|
|
209
|
-
...extra
|
|
210
|
-
};
|
|
211
|
-
return this.getWMSUrl(options, extra);
|
|
134
|
+
// ImageSource implementation
|
|
135
|
+
getMetadata(): Promise<ImageSourceMetadata> {
|
|
136
|
+
return this.getCapabilities();
|
|
212
137
|
}
|
|
213
138
|
|
|
214
|
-
|
|
215
|
-
parameters
|
|
216
|
-
extra?: Record<string, unknown>
|
|
217
|
-
): string {
|
|
218
|
-
const options: Required<WMSGetLegendGraphicParameters> = {
|
|
219
|
-
...WMS_GET_LEGEND_GRAPHIC_DEFAULT_PARAMETERS,
|
|
220
|
-
...parameters,
|
|
221
|
-
...extra
|
|
222
|
-
};
|
|
223
|
-
return this.getWMSUrl(options, extra);
|
|
139
|
+
getImage(parameters: GetImageParameters): Promise<ImageType> {
|
|
140
|
+
return this.getMap(parameters);
|
|
224
141
|
}
|
|
225
142
|
|
|
226
143
|
// WMS Service API Stubs
|
|
227
144
|
|
|
228
145
|
/** Get Capabilities */
|
|
229
146
|
async getCapabilities(
|
|
230
|
-
|
|
231
|
-
|
|
147
|
+
wmsParameters?: WMSGetCapabilitiesParameters,
|
|
148
|
+
vendorParameters?: Record<string, unknown>
|
|
232
149
|
): Promise<WMSCapabilities> {
|
|
233
|
-
const url = this.getCapabilitiesURL(
|
|
234
|
-
const
|
|
235
|
-
await this.
|
|
150
|
+
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
151
|
+
const {fetch} = this;
|
|
152
|
+
const response = await fetch(url, this.loadOptions);
|
|
236
153
|
const arrayBuffer = await response.arrayBuffer();
|
|
154
|
+
this._checkResponse(response, arrayBuffer);
|
|
237
155
|
return await WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);
|
|
238
156
|
}
|
|
239
157
|
|
|
240
158
|
/** Get a map image */
|
|
241
|
-
async getMap(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
159
|
+
async getMap(
|
|
160
|
+
options: WMSGetMapParameters,
|
|
161
|
+
vendorParameters?: Record<string, unknown>
|
|
162
|
+
): Promise<ImageType> {
|
|
163
|
+
const url = this.getMapURL(options, vendorParameters);
|
|
164
|
+
const {fetch} = this;
|
|
165
|
+
const response = await fetch(url, this.loadOptions);
|
|
245
166
|
const arrayBuffer = await response.arrayBuffer();
|
|
246
|
-
|
|
167
|
+
this._checkResponse(response, arrayBuffer);
|
|
168
|
+
try {
|
|
169
|
+
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
170
|
+
} catch {
|
|
171
|
+
throw this._parseError(arrayBuffer);
|
|
172
|
+
}
|
|
247
173
|
}
|
|
248
174
|
|
|
249
175
|
/** Get Feature Info for a coordinate */
|
|
250
176
|
async getFeatureInfo(
|
|
251
177
|
options: WMSGetFeatureInfoParameters,
|
|
252
|
-
|
|
178
|
+
vendorParameters?: Record<string, unknown>
|
|
253
179
|
): Promise<WMSFeatureInfo> {
|
|
254
|
-
const url = this.getFeatureInfoURL(options,
|
|
180
|
+
const url = this.getFeatureInfoURL(options, vendorParameters);
|
|
255
181
|
const response = await this.fetch(url, this.loadOptions);
|
|
256
|
-
await this.checkResponse(response);
|
|
257
182
|
const arrayBuffer = await response.arrayBuffer();
|
|
183
|
+
this._checkResponse(response, arrayBuffer);
|
|
258
184
|
return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
|
|
259
185
|
}
|
|
260
186
|
|
|
261
187
|
/** Get more information about a layer */
|
|
262
188
|
async describeLayer(
|
|
263
189
|
options: WMSDescribeLayerParameters,
|
|
264
|
-
|
|
190
|
+
vendorParameters?: Record<string, unknown>
|
|
265
191
|
): Promise<WMSLayerDescription> {
|
|
266
|
-
const url = this.describeLayerURL(options,
|
|
192
|
+
const url = this.describeLayerURL(options, vendorParameters);
|
|
267
193
|
const response = await this.fetch(url, this.loadOptions);
|
|
268
|
-
await this.checkResponse(response);
|
|
269
194
|
const arrayBuffer = await response.arrayBuffer();
|
|
195
|
+
this._checkResponse(response, arrayBuffer);
|
|
270
196
|
return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
271
197
|
}
|
|
272
198
|
|
|
273
199
|
/** Get an image with a semantic legend */
|
|
274
200
|
async getLegendGraphic(
|
|
275
201
|
options: WMSGetLegendGraphicParameters,
|
|
276
|
-
|
|
202
|
+
vendorParameters?: Record<string, unknown>
|
|
277
203
|
): Promise<ImageType> {
|
|
278
|
-
const url = this.getLegendGraphicURL(options,
|
|
204
|
+
const url = this.getLegendGraphicURL(options, vendorParameters);
|
|
279
205
|
const response = await this.fetch(url, this.loadOptions);
|
|
280
|
-
await this.checkResponse(response);
|
|
281
206
|
const arrayBuffer = await response.arrayBuffer();
|
|
282
|
-
|
|
207
|
+
this._checkResponse(response, arrayBuffer);
|
|
208
|
+
try {
|
|
209
|
+
return await ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
210
|
+
} catch {
|
|
211
|
+
throw this._parseError(arrayBuffer);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Typed URL creators
|
|
216
|
+
// For applications that want full control of fetching and parsing
|
|
217
|
+
|
|
218
|
+
/** Generate a URL for the GetCapabilities request */
|
|
219
|
+
getCapabilitiesURL(
|
|
220
|
+
wmsParameters?: WMSGetCapabilitiesParameters,
|
|
221
|
+
vendorParameters?: Record<string, unknown>
|
|
222
|
+
): string {
|
|
223
|
+
const options: Required<WMSGetCapabilitiesParameters> = {
|
|
224
|
+
service: 'WMS',
|
|
225
|
+
version: '1.1.1',
|
|
226
|
+
request: 'GetCapabilities',
|
|
227
|
+
...wmsParameters,
|
|
228
|
+
...vendorParameters
|
|
229
|
+
};
|
|
230
|
+
return this._getWMSUrl(options, vendorParameters);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Generate a URL for the GetMap request */
|
|
234
|
+
getMapURL(
|
|
235
|
+
wmsParameters: WMSGetMapParameters,
|
|
236
|
+
vendorParameters?: Record<string, unknown>
|
|
237
|
+
): string {
|
|
238
|
+
const options: Required<WMSGetMapParameters> = {
|
|
239
|
+
service: 'WMS',
|
|
240
|
+
version: '1.1.1',
|
|
241
|
+
request: 'GetMap',
|
|
242
|
+
// layers: [],
|
|
243
|
+
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
244
|
+
// width: 1200,
|
|
245
|
+
// height: 900,
|
|
246
|
+
styles: undefined,
|
|
247
|
+
srs: 'EPSG:4326',
|
|
248
|
+
format: 'image/png',
|
|
249
|
+
...wmsParameters,
|
|
250
|
+
...vendorParameters
|
|
251
|
+
};
|
|
252
|
+
return this._getWMSUrl(options, vendorParameters);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Generate a URL for the GetFeatureInfo request */
|
|
256
|
+
getFeatureInfoURL(
|
|
257
|
+
wmsParameters: WMSGetFeatureInfoParameters,
|
|
258
|
+
vendorParameters?: Record<string, unknown>
|
|
259
|
+
): string {
|
|
260
|
+
const options: Required<WMSGetFeatureInfoParameters> = {
|
|
261
|
+
service: 'WMS',
|
|
262
|
+
version: '1.1.1',
|
|
263
|
+
request: 'GetFeatureInfo',
|
|
264
|
+
// layers: [],
|
|
265
|
+
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
266
|
+
// width: 1200,
|
|
267
|
+
// height: 900,
|
|
268
|
+
// x: undefined!,
|
|
269
|
+
// y: undefined!,
|
|
270
|
+
// query_layers: [],
|
|
271
|
+
srs: 'EPSG:4326',
|
|
272
|
+
format: 'image/png',
|
|
273
|
+
info_format: 'text/plain',
|
|
274
|
+
styles: undefined,
|
|
275
|
+
...wmsParameters,
|
|
276
|
+
...vendorParameters
|
|
277
|
+
};
|
|
278
|
+
return this._getWMSUrl(options, vendorParameters);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** Generate a URL for the GetFeatureInfo request */
|
|
282
|
+
describeLayerURL(
|
|
283
|
+
wmsParameters: WMSDescribeLayerParameters,
|
|
284
|
+
vendorParameters?: Record<string, unknown>
|
|
285
|
+
): string {
|
|
286
|
+
const options: Required<WMSDescribeLayerParameters> = {
|
|
287
|
+
service: 'WMS',
|
|
288
|
+
version: '1.1.1',
|
|
289
|
+
request: 'DescribeLayer',
|
|
290
|
+
...wmsParameters,
|
|
291
|
+
...vendorParameters
|
|
292
|
+
};
|
|
293
|
+
return this._getWMSUrl(options, vendorParameters);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
getLegendGraphicURL(
|
|
297
|
+
wmsParameters: WMSGetLegendGraphicParameters,
|
|
298
|
+
vendorParameters?: Record<string, unknown>
|
|
299
|
+
): string {
|
|
300
|
+
const options: Required<WMSGetLegendGraphicParameters> = {
|
|
301
|
+
service: 'WMS',
|
|
302
|
+
version: '1.1.1',
|
|
303
|
+
request: 'GetLegendGraphic',
|
|
304
|
+
...wmsParameters,
|
|
305
|
+
...vendorParameters
|
|
306
|
+
};
|
|
307
|
+
return this._getWMSUrl(options, vendorParameters);
|
|
283
308
|
}
|
|
284
309
|
|
|
285
310
|
// INTERNAL METHODS
|
|
286
311
|
|
|
287
312
|
/**
|
|
288
|
-
* @note
|
|
289
|
-
* @note if override is common, maybe add a callback prop?
|
|
313
|
+
* @note case _getWMSUrl may need to be overridden to handle certain backends?
|
|
290
314
|
* */
|
|
291
|
-
protected
|
|
292
|
-
options:
|
|
293
|
-
|
|
294
|
-
layers?: string[];
|
|
295
|
-
},
|
|
296
|
-
extra?: Record<string, unknown>
|
|
315
|
+
protected _getWMSUrl(
|
|
316
|
+
options: Record<string, unknown>,
|
|
317
|
+
vendorParameters?: Record<string, unknown>
|
|
297
318
|
): string {
|
|
298
|
-
let url = `${this.
|
|
299
|
-
|
|
300
|
-
|
|
319
|
+
let url = `${this.serviceUrl}`;
|
|
320
|
+
let first = true;
|
|
321
|
+
for (const [key, value] of Object.entries(options)) {
|
|
322
|
+
url += first ? '?' : '&';
|
|
323
|
+
first = false;
|
|
324
|
+
if (Array.isArray(value)) {
|
|
325
|
+
url += `${key.toUpperCase()}=${value.join(',')}`;
|
|
326
|
+
} else {
|
|
327
|
+
url += `${key.toUpperCase()}=${value ? String(value) : ''}`;
|
|
328
|
+
}
|
|
301
329
|
}
|
|
302
|
-
return url;
|
|
330
|
+
return encodeURI(url);
|
|
303
331
|
}
|
|
304
332
|
|
|
305
333
|
/** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
|
|
306
|
-
protected
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const error =
|
|
334
|
+
protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {
|
|
335
|
+
const contentType = response.headers['content-type'];
|
|
336
|
+
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
337
|
+
const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
310
338
|
throw new Error(error);
|
|
311
339
|
}
|
|
312
340
|
}
|
|
341
|
+
|
|
342
|
+
/** Error situation detected */
|
|
343
|
+
protected _parseError(arrayBuffer: ArrayBuffer): Error {
|
|
344
|
+
const error = WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
345
|
+
return new Error(error);
|
|
346
|
+
}
|
|
313
347
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// https://github.com/nodejs/node/commit/c1d82ac2ff15594840e2a1b9531b506ae067ed27;
|
|
2
|
+
|
|
3
|
+
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
|
|
4
|
+
//
|
|
5
|
+
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
|
|
6
|
+
//
|
|
7
|
+
// Originally from narwhal.js (http://narwhaljs.org)
|
|
8
|
+
// Copyright (c) 2009 Thomas Robinson <280north.com>
|
|
9
|
+
//
|
|
10
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
// of this software and associated documentation files (the 'Software'), to
|
|
12
|
+
// deal in the Software without restriction, including without limitation the
|
|
13
|
+
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
14
|
+
// sell copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
// furnished to do so, subject to the following conditions:
|
|
16
|
+
//
|
|
17
|
+
// The above copyright notice and this permission notice shall be included in
|
|
18
|
+
// all copies or substantial portions of the Software.
|
|
19
|
+
//
|
|
20
|
+
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
24
|
+
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
25
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
|
|
27
|
+
/** @todo replace this ridiculous choice of deepStrictEqual */
|
|
28
|
+
// eslint-disable-next-line complexity
|
|
29
|
+
export function deepStrictEqual(actual: unknown, expected: unknown, strict?: boolean) {
|
|
30
|
+
// 7.1. All identical values are equivalent, as determined by ===.
|
|
31
|
+
if (actual === expected) {
|
|
32
|
+
return true;
|
|
33
|
+
// } else if (actual instanceof Buffer && expected instanceof Buffer) {
|
|
34
|
+
// return compare(actual, expected) === 0;
|
|
35
|
+
|
|
36
|
+
// // 7.2. If the expected value is a Date object, the actual value is
|
|
37
|
+
// // equivalent if it is also a Date object that refers to the same time.
|
|
38
|
+
} else if (actual instanceof Date && expected instanceof Date) {
|
|
39
|
+
return actual.getTime() === expected.getTime();
|
|
40
|
+
|
|
41
|
+
// 7.3 If the expected value is a RegExp object, the actual value is
|
|
42
|
+
// equivalent if it is also a RegExp object with the same source and
|
|
43
|
+
// properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
|
|
44
|
+
} else if (actual instanceof RegExp && expected instanceof RegExp) {
|
|
45
|
+
return (
|
|
46
|
+
actual.source === expected.source &&
|
|
47
|
+
actual.global === expected.global &&
|
|
48
|
+
actual.multiline === expected.multiline &&
|
|
49
|
+
actual.lastIndex === expected.lastIndex &&
|
|
50
|
+
actual.ignoreCase === expected.ignoreCase
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// 7.4. Other pairs that do not both pass typeof value == 'object',
|
|
54
|
+
// equivalence is determined by ==.
|
|
55
|
+
} else if (
|
|
56
|
+
(actual === null || typeof actual !== 'object') &&
|
|
57
|
+
(expected === null || typeof expected !== 'object')
|
|
58
|
+
) {
|
|
59
|
+
// eslint-disable-next-line eqeqeq
|
|
60
|
+
return strict ? actual === expected : actual == expected;
|
|
61
|
+
|
|
62
|
+
// 7.5 For all other Object pairs, including Array objects, equivalence is
|
|
63
|
+
// determined by having the same number of owned properties (as verified
|
|
64
|
+
// with Object.prototype.hasOwnProperty.call), the same set of keys
|
|
65
|
+
// (although not necessarily the same order), equivalent values for every
|
|
66
|
+
// corresponding key, and an identical 'prototype' property. Note: this
|
|
67
|
+
// accounts for both named and indexed properties on Arrays.
|
|
68
|
+
}
|
|
69
|
+
return objEquiv(actual, expected, strict);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
73
|
+
const pSlice = Array.prototype.slice;
|
|
74
|
+
|
|
75
|
+
function isPrimitive(arg) {
|
|
76
|
+
return arg === null || (typeof arg !== 'object' && typeof arg !== 'function');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isArguments(object) {
|
|
80
|
+
// eslint-disable-next-line eqeqeq
|
|
81
|
+
return Object.prototype.toString.call(object) == '[object Arguments]';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// eslint-disable-next-line complexity
|
|
85
|
+
function objEquiv(a: unknown, b: unknown, strict) {
|
|
86
|
+
if (a === null || a === undefined || b === null || b === undefined) return false;
|
|
87
|
+
// if one is a primitive, the other must be same
|
|
88
|
+
if (isPrimitive(a) || isPrimitive(b)) return a === b;
|
|
89
|
+
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;
|
|
90
|
+
const aIsArgs = isArguments(a);
|
|
91
|
+
const bIsArgs = isArguments(b);
|
|
92
|
+
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false;
|
|
93
|
+
if (aIsArgs) {
|
|
94
|
+
a = pSlice.call(a);
|
|
95
|
+
b = pSlice.call(b);
|
|
96
|
+
return deepStrictEqual(a, b, strict);
|
|
97
|
+
}
|
|
98
|
+
const ka = Object.keys(a);
|
|
99
|
+
const kb = Object.keys(b);
|
|
100
|
+
let key;
|
|
101
|
+
let i;
|
|
102
|
+
// having the same number of owned properties (keys incorporates
|
|
103
|
+
// hasOwnProperty)
|
|
104
|
+
if (ka.length !== kb.length) return false;
|
|
105
|
+
// the same set of keys (although not necessarily the same order),
|
|
106
|
+
ka.sort();
|
|
107
|
+
kb.sort();
|
|
108
|
+
// ~~~cheap key test
|
|
109
|
+
for (i = ka.length - 1; i >= 0; i--) {
|
|
110
|
+
if (ka[i] !== kb[i]) return false;
|
|
111
|
+
}
|
|
112
|
+
// equivalent values for every corresponding key, and
|
|
113
|
+
// ~~~possibly expensive deep test
|
|
114
|
+
for (i = ka.length - 1; i >= 0; i--) {
|
|
115
|
+
key = ka[i];
|
|
116
|
+
if (!deepStrictEqual(a[key], b[key], strict)) return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
package/src/lib/gml/parse-gml.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
} from '@loaders.gl/schema';
|
|
23
23
|
|
|
24
24
|
import {XMLLoader} from '@loaders.gl/xml';
|
|
25
|
-
import deepStrictEqual from 'deep-strict-equal';
|
|
25
|
+
import {deepStrictEqual} from './deep-strict-equal';
|
|
26
26
|
import rewind from '@turf/rewind';
|
|
27
27
|
|
|
28
28
|
function noTransform(...coords) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// loaders.gl, MIT license
|
|
2
|
+
|
|
3
|
+
/** Data returned by LERC loader */
|
|
4
|
+
export type LERCData = {
|
|
5
|
+
/** Width of decoded image */
|
|
6
|
+
width: number;
|
|
7
|
+
/** Height of decoded image */
|
|
8
|
+
height: number;
|
|
9
|
+
/** The type of pixels represented in the output */
|
|
10
|
+
pixelType: LercPixelType;
|
|
11
|
+
/** [statistics_band1, statistics_band2, …] Each element is a statistics object representing min and max values */
|
|
12
|
+
statistics: BandStats[];
|
|
13
|
+
/** [band1, band2, …] Each band is a typed array of width * height * depthCount */
|
|
14
|
+
pixels: TypedArray[];
|
|
15
|
+
/** Typed array with a size of width*height, or null if all pixels are valid */
|
|
16
|
+
mask: Uint8Array;
|
|
17
|
+
/** Depth count */
|
|
18
|
+
depthCount: number;
|
|
19
|
+
/** array [band1_mask, band2_mask, …] Each band is a Uint8Array of width * height * depthCount */
|
|
20
|
+
bandMasks?: Uint8Array[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type LercPixelType = 'S8' | 'U8' | 'S16' | 'U16' | 'S32' | 'U32' | 'F32' | 'F64';
|
|
24
|
+
|
|
25
|
+
export interface BandStats {
|
|
26
|
+
minValue: number;
|
|
27
|
+
maxValue: number;
|
|
28
|
+
depthStats?: {
|
|
29
|
+
minValues: Float64Array;
|
|
30
|
+
maxValues: Float64Array;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type TypedArray =
|
|
35
|
+
| Int8Array
|
|
36
|
+
| Uint8Array
|
|
37
|
+
| Uint8ClampedArray
|
|
38
|
+
| Int16Array
|
|
39
|
+
| Uint16Array
|
|
40
|
+
| Int32Array
|
|
41
|
+
| Uint32Array
|
|
42
|
+
| Float32Array
|
|
43
|
+
| Float64Array;
|