@loaders.gl/wms 4.3.1 → 4.4.0-alpha.1
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/{services/arcgis/arcgis-feature-server.d.ts → arcgis/arcgis-feature-source.d.ts} +14 -21
- package/dist/arcgis/arcgis-feature-source.d.ts.map +1 -0
- package/dist/{services/arcgis/arcgis-feature-server.js → arcgis/arcgis-feature-source.js} +74 -79
- package/dist/{services/arcgis/arcgis-image-server.d.ts → arcgis/arcgis-image-source.d.ts} +10 -12
- package/dist/arcgis/arcgis-image-source.d.ts.map +1 -0
- package/dist/{services/arcgis/arcgis-image-server.js → arcgis/arcgis-image-source.js} +7 -13
- package/dist/arcgis/arcgis-server.d.ts.map +1 -0
- package/dist/csw-capabilities-loader.js +1 -1
- package/dist/csw-domain-loader.js +1 -1
- package/dist/csw-records-loader.js +1 -1
- package/dist/{services/ogc/csw-service.d.ts → csw-source.d.ts} +40 -26
- package/dist/csw-source.d.ts.map +1 -0
- package/dist/{services/ogc/csw-service.js → csw-source.js} +44 -32
- package/dist/gml-loader.js +1 -1
- package/dist/index.cjs +36 -45
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/lib/deprecated/create-image-source.d.ts +12 -8
- package/dist/lib/deprecated/create-image-source.d.ts.map +1 -1
- package/dist/lib/deprecated/create-image-source.js +6 -6
- package/dist/wfs-capabilities-loader.js +1 -1
- package/dist/{services/ogc/wfs-service.d.ts → wfs-source.d.ts} +43 -52
- package/dist/wfs-source.d.ts.map +1 -0
- package/dist/{services/ogc/wfs-service.js → wfs-source.js} +74 -106
- package/dist/wip/wcs-capabilities-loader.js +1 -1
- package/dist/wip/wmts-capabilities-loader.js +1 -1
- package/dist/wms-capabilities-loader.js +1 -1
- package/dist/wms-error-loader.js +1 -1
- package/dist/{services/ogc/wms-service.d.ts → wms-source.d.ts} +23 -32
- package/dist/wms-source.d.ts.map +1 -0
- package/dist/{services/ogc/wms-service.js → wms-source.js} +20 -25
- package/package.json +7 -7
- package/src/{services/arcgis/arcgis-feature-server.ts → arcgis/arcgis-feature-source.ts} +93 -97
- package/src/{services/arcgis/arcgis-image-server.ts → arcgis/arcgis-image-source.ts} +18 -23
- package/src/{services/ogc/csw-service.ts → csw-source.ts} +56 -41
- package/src/index.ts +4 -6
- package/src/lib/deprecated/create-image-source.ts +22 -18
- package/src/{services/ogc/wfs-service.ts → wfs-source.ts} +93 -133
- package/src/{services/ogc/wms-service.ts → wms-source.ts} +44 -56
- package/dist/services/arcgis/arcgis-feature-server.d.ts.map +0 -1
- package/dist/services/arcgis/arcgis-image-server.d.ts.map +0 -1
- package/dist/services/arcgis/arcgis-server.d.ts.map +0 -1
- package/dist/services/ogc/csw-service.d.ts.map +0 -1
- package/dist/services/ogc/wfs-service.d.ts.map +0 -1
- package/dist/services/ogc/wms-service.d.ts.map +0 -1
- /package/dist/{services/arcgis → arcgis}/arcgis-server.d.ts +0 -0
- /package/dist/{services/arcgis → arcgis}/arcgis-server.js +0 -0
- /package/src/{services/arcgis → arcgis}/arcgis-server.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/deprecated/create-image-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"create-image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/deprecated/create-image-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AACnG,OAAO,KAAK,EAAC,gBAAgB,EAAC,4BAAyB;AAIvD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,qBAAqB,GAAG,UAAU,CAAC;AAIzE;;GAEG;AACH,KAAK,wBAAwB,GAAG,iBAAiB,GAC/C,gBAAgB,GAAG;IACjB,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;CACjC,CAAC;AAEJ;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IAC5C,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CAC7B,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAS1C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// loaders.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { WMSSource } from "../../
|
|
5
|
-
import { ArcGISImageServerSource } from "../../
|
|
4
|
+
import { WMSSource } from "../../wms-source.js";
|
|
5
|
+
import { ArcGISImageServerSource } from "../../arcgis/arcgis-image-source.js";
|
|
6
6
|
const SOURCES = [WMSSource, ArcGISImageServerSource];
|
|
7
7
|
/**
|
|
8
8
|
* Creates an image source
|
|
@@ -13,13 +13,13 @@ const SOURCES = [WMSSource, ArcGISImageServerSource];
|
|
|
13
13
|
*
|
|
14
14
|
* @deprecated Use createDataSource from @loaders.gl/core
|
|
15
15
|
*/
|
|
16
|
-
export function createImageSource(
|
|
17
|
-
const { type = 'auto' } =
|
|
18
|
-
const source = type === 'auto' ? guessSourceType(
|
|
16
|
+
export function createImageSource(options) {
|
|
17
|
+
const { type = 'auto', url, sources = SOURCES, loadOptions } = options;
|
|
18
|
+
const source = type === 'auto' ? guessSourceType(url, sources) : getSourceOfType(type, sources);
|
|
19
19
|
if (!source) {
|
|
20
20
|
throw new Error('Not a valid image source type');
|
|
21
21
|
}
|
|
22
|
-
return source.createDataSource(
|
|
22
|
+
return source.createDataSource(url, { core: { loadOptions } });
|
|
23
23
|
}
|
|
24
24
|
/** Guess service type from URL */
|
|
25
25
|
function getSourceOfType(type, sources) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { parseWFSCapabilities } from "./lib/parsers/wfs/parse-wfs-capabilities.js";
|
|
3
3
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
4
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
-
const VERSION = typeof "4.
|
|
5
|
+
const VERSION = typeof "4.4.0-alpha.0" !== 'undefined' ? "4.4.0-alpha.0" : 'latest';
|
|
6
6
|
/**
|
|
7
7
|
* Loader for the response to the WFS GetCapability request
|
|
8
8
|
* @deprecated Warning: this loader is still experimental and incomplete
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { Schema, GeoJSONTable } from '@loaders.gl/schema';
|
|
2
|
-
import type {
|
|
3
|
-
import { VectorSource } from '@loaders.gl/loader-utils';
|
|
4
|
-
import type { WFSCapabilities } from "
|
|
1
|
+
import type { Schema, GeoJSONTable } from '@loaders.gl/schema';
|
|
2
|
+
import type { DataSourceOptions, VectorSourceMetadata, GetFeaturesParameters } from '@loaders.gl/loader-utils';
|
|
3
|
+
import { DataSource, VectorSource } from '@loaders.gl/loader-utils';
|
|
4
|
+
import type { WFSCapabilities } from "./wfs-capabilities-loader.js";
|
|
5
|
+
/** Properties for creating a enw WFS service */
|
|
6
|
+
export type WFSourceOptions = DataSourceOptions & {
|
|
7
|
+
wfs?: {
|
|
8
|
+
/** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
|
|
9
|
+
substituteCRS84?: boolean;
|
|
10
|
+
/** Default WFS parameters. If not provided here, must be provided in the various request */
|
|
11
|
+
wfsParameters?: WFSParameters;
|
|
12
|
+
/** Any additional service specific parameters */
|
|
13
|
+
vendorParameters?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
5
16
|
/**
|
|
6
|
-
* @
|
|
17
|
+
* @deprecated This is a WIP, not fully implemented
|
|
7
18
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
8
19
|
*/
|
|
9
20
|
export declare const WFSSource: {
|
|
@@ -13,31 +24,14 @@ export declare const WFSSource: {
|
|
|
13
24
|
readonly version: "0.0.0";
|
|
14
25
|
readonly extensions: [];
|
|
15
26
|
readonly mimeTypes: [];
|
|
16
|
-
readonly options: {
|
|
17
|
-
readonly url: never;
|
|
18
|
-
readonly wfs: {
|
|
19
|
-
/** Tabular loaders, normally the GeoJSONLoader */
|
|
20
|
-
readonly loaders: [];
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
27
|
readonly type: "wfs";
|
|
24
28
|
readonly fromUrl: true;
|
|
25
29
|
readonly fromBlob: false;
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
/** Properties for creating a enw WFS service */
|
|
30
|
-
export type WFSVectorSourceProps = VectorSourceProps & {
|
|
31
|
-
url: string;
|
|
32
|
-
wfs?: {
|
|
33
|
-
loaders: LoaderWithParser[];
|
|
34
|
-
/** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */
|
|
35
|
-
substituteCRS84?: boolean;
|
|
36
|
-
/** Default WFS parameters. If not provided here, must be provided in the various request */
|
|
37
|
-
wmsParameters?: WFSParameters;
|
|
38
|
-
/** Any additional service specific parameters */
|
|
39
|
-
vendorParameters?: Record<string, unknown>;
|
|
30
|
+
readonly defaultOptions: {
|
|
31
|
+
readonly wfs: {};
|
|
40
32
|
};
|
|
33
|
+
readonly testURL: (url: string) => boolean;
|
|
34
|
+
readonly createDataSource: (url: string, options: WFSourceOptions) => WFSVectorSource;
|
|
41
35
|
};
|
|
42
36
|
/**
|
|
43
37
|
* "Static" WFS parameters (not viewport or selected pixel dependent)
|
|
@@ -156,27 +150,24 @@ export type WFSGetLegendGraphicParameters = {
|
|
|
156
150
|
* - implements the VectorSource interface
|
|
157
151
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
158
152
|
*/
|
|
159
|
-
export declare class WFSVectorSource extends
|
|
160
|
-
/** Base URL to the service */
|
|
161
|
-
readonly url: string;
|
|
162
|
-
readonly data: string;
|
|
153
|
+
export declare class WFSVectorSource extends DataSource<string, WFSourceOptions> implements VectorSource {
|
|
163
154
|
/** Default static vendor parameters */
|
|
164
155
|
vendorParameters?: Record<string, unknown>;
|
|
165
156
|
capabilities: WFSCapabilities | null;
|
|
166
157
|
/** Create a WFSVectorSource */
|
|
167
|
-
constructor(
|
|
158
|
+
constructor(data: string, options: WFSourceOptions);
|
|
168
159
|
getSchema(): Promise<Schema>;
|
|
169
160
|
getMetadata(): Promise<VectorSourceMetadata>;
|
|
170
161
|
getFeatures(parameters: GetFeaturesParameters): Promise<GeoJSONTable>;
|
|
171
162
|
normalizeMetadata(capabilities: WFSCapabilities): VectorSourceMetadata;
|
|
172
163
|
/** Get Capabilities */
|
|
173
|
-
getCapabilities(
|
|
164
|
+
getCapabilities(wfsParameters?: WFSGetCapabilitiesParameters, vendorParameters?: Record<string, unknown>): Promise<WFSCapabilities>;
|
|
174
165
|
/** Get a map image *
|
|
175
166
|
async getMap(
|
|
176
|
-
|
|
167
|
+
wfsParameters: WFSGetMapParameters,
|
|
177
168
|
vendorParameters?: Record<string, unknown>
|
|
178
169
|
): Promise<ImageType> {
|
|
179
|
-
const url = this.getMapURL(
|
|
170
|
+
const url = this.getMapURL(wfsParameters, vendorParameters);
|
|
180
171
|
const response = await this.fetch(url);
|
|
181
172
|
const arrayBuffer = await response.arrayBuffer();
|
|
182
173
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -189,10 +180,10 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
189
180
|
|
|
190
181
|
/** Get Feature Info for a coordinate *
|
|
191
182
|
async getFeatureInfo(
|
|
192
|
-
|
|
183
|
+
wfsParameters: WFSGetFeatureInfoParameters,
|
|
193
184
|
vendorParameters?: Record<string, unknown>
|
|
194
185
|
): Promise<WFSFeatureInfo> {
|
|
195
|
-
const url = this.getFeatureInfoURL(
|
|
186
|
+
const url = this.getFeatureInfoURL(wfsParameters, vendorParameters);
|
|
196
187
|
const response = await this.fetch(url);
|
|
197
188
|
const arrayBuffer = await response.arrayBuffer();
|
|
198
189
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -201,10 +192,10 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
201
192
|
|
|
202
193
|
/** Get Feature Info for a coordinate *
|
|
203
194
|
async getFeatureInfoText(
|
|
204
|
-
|
|
195
|
+
wfsParameters: WFSGetFeatureInfoParameters,
|
|
205
196
|
vendorParameters?: Record<string, unknown>
|
|
206
197
|
): Promise<string> {
|
|
207
|
-
const url = this.getFeatureInfoURL(
|
|
198
|
+
const url = this.getFeatureInfoURL(wfsParameters, vendorParameters);
|
|
208
199
|
const response = await this.fetch(url);
|
|
209
200
|
const arrayBuffer = await response.arrayBuffer();
|
|
210
201
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -213,10 +204,10 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
213
204
|
|
|
214
205
|
/** Get more information about a layer *
|
|
215
206
|
async describeLayer(
|
|
216
|
-
|
|
207
|
+
wfsParameters: WFSDescribeLayerParameters,
|
|
217
208
|
vendorParameters?: Record<string, unknown>
|
|
218
209
|
): Promise<WFSLayerDescription> {
|
|
219
|
-
const url = this.describeLayerURL(
|
|
210
|
+
const url = this.describeLayerURL(wfsParameters, vendorParameters);
|
|
220
211
|
const response = await this.fetch(url);
|
|
221
212
|
const arrayBuffer = await response.arrayBuffer();
|
|
222
213
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -225,10 +216,10 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
225
216
|
|
|
226
217
|
/** Get an image with a semantic legend *
|
|
227
218
|
async getLegendGraphic(
|
|
228
|
-
|
|
219
|
+
wfsParameters: WFSGetLegendGraphicParameters,
|
|
229
220
|
vendorParameters?: Record<string, unknown>
|
|
230
221
|
): Promise<ImageType> {
|
|
231
|
-
const url = this.getLegendGraphicURL(
|
|
222
|
+
const url = this.getLegendGraphicURL(wfsParameters, vendorParameters);
|
|
232
223
|
const response = await this.fetch(url);
|
|
233
224
|
const arrayBuffer = await response.arrayBuffer();
|
|
234
225
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -240,14 +231,14 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
240
231
|
}
|
|
241
232
|
*/
|
|
242
233
|
/** Generate a URL for the GetCapabilities request */
|
|
243
|
-
getCapabilitiesURL(
|
|
234
|
+
getCapabilitiesURL(wfsParameters?: WFSGetCapabilitiesParameters, vendorParameters?: Record<string, unknown>): string;
|
|
244
235
|
/** Generate a URL for the GetMap request */
|
|
245
|
-
getMapURL(
|
|
236
|
+
getMapURL(wfsParameters: WFSGetMapParameters, vendorParameters?: Record<string, unknown>): string;
|
|
246
237
|
/** Generate a URL for the GetFeatureInfo request */
|
|
247
|
-
getFeatureInfoURL(
|
|
238
|
+
getFeatureInfoURL(wfsParameters: WFSGetFeatureInfoParameters, vendorParameters?: Record<string, unknown>): string;
|
|
248
239
|
/** Generate a URL for the GetFeatureInfo request */
|
|
249
|
-
describeLayerURL(
|
|
250
|
-
getLegendGraphicURL(
|
|
240
|
+
describeLayerURL(wfsParameters: WFSDescribeLayerParameters, vendorParameters?: Record<string, unknown>): string;
|
|
241
|
+
getLegendGraphicURL(wfsParameters: WFSGetLegendGraphicParameters, vendorParameters?: Record<string, unknown>): string;
|
|
251
242
|
_parseWFSUrl(url: string): {
|
|
252
243
|
url: string;
|
|
253
244
|
parameters: Record<string, unknown>;
|
|
@@ -257,17 +248,17 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
257
248
|
* @note case _getWFSUrl may need to be overridden to handle certain backends?
|
|
258
249
|
* @note at the moment, only URLs with parameters are supported (no XML payloads)
|
|
259
250
|
* */
|
|
260
|
-
protected _getWFSUrl(request: string,
|
|
251
|
+
protected _getWFSUrl(request: string, wfsParameters: {
|
|
261
252
|
version?: '1.3.0' | '1.1.1';
|
|
262
253
|
[key: string]: unknown;
|
|
263
254
|
}, vendorParameters?: Record<string, unknown>): string;
|
|
264
255
|
_getWFS130Parameters<ParametersT extends {
|
|
265
256
|
crs?: string;
|
|
266
257
|
srs?: string;
|
|
267
|
-
}>(
|
|
268
|
-
_getURLParameter(key: string, value: unknown,
|
|
258
|
+
}>(wfsParameters: ParametersT): ParametersT;
|
|
259
|
+
_getURLParameter(key: string, value: unknown, wfsParameters: WFSParameters): string;
|
|
269
260
|
/** Coordinate order is flipped for certain CRS in WFS 1.3.0 */
|
|
270
|
-
_flipBoundingBox(bboxValue: unknown,
|
|
261
|
+
_flipBoundingBox(bboxValue: unknown, wfsParameters: WFSParameters): [number, number, number, number] | null;
|
|
271
262
|
/** Fetches an array buffer and checks the response (boilerplate reduction) */
|
|
272
263
|
protected _fetchArrayBuffer(url: string): Promise<ArrayBuffer>;
|
|
273
264
|
/** Checks for and parses a WFS XML formatted ServiceError and throws an exception */
|
|
@@ -275,4 +266,4 @@ export declare class WFSVectorSource extends VectorSource<WFSVectorSourceProps>
|
|
|
275
266
|
/** Error situation detected */
|
|
276
267
|
protected _parseError(arrayBuffer: ArrayBuffer): Error;
|
|
277
268
|
}
|
|
278
|
-
//# sourceMappingURL=wfs-
|
|
269
|
+
//# sourceMappingURL=wfs-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfs-source.d.ts","sourceRoot":"","sources":["../src/wfs-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAS,UAAU,EAAE,YAAY,EAAe,MAAM,0BAA0B,CAAC;AAExF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C,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IA4BT,oBAAoB,CAAC,WAAW,SAAS;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAC,EACnE,aAAa,EAAE,WAAW,GACzB,WAAW;IAUd,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,GAAG,MAAM;IAwDnF,+DAA+D;IAC/D,gBAAgB,CACd,SAAS,EAAE,OAAO,EAClB,aAAa,EAAE,aAAa,GAC3B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAkB1C,8EAA8E;cAC9D,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOpE,qFAAqF;IACrF,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI;IAY5E,+BAA+B;IAC/B,SAAS,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,KAAK;CAIvD"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// loaders.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import {
|
|
5
|
-
import { WFSCapabilitiesLoader } from "
|
|
6
|
-
import { WMSErrorLoader } from "
|
|
7
|
-
/* eslint-disable camelcase */ // WFS XML parameters use snake_case
|
|
4
|
+
import { DataSource, mergeOptions } from '@loaders.gl/loader-utils';
|
|
5
|
+
import { WFSCapabilitiesLoader } from "./wfs-capabilities-loader.js";
|
|
6
|
+
import { WMSErrorLoader } from "./wms-error-loader.js";
|
|
8
7
|
/**
|
|
9
|
-
* @
|
|
8
|
+
* @deprecated This is a WIP, not fully implemented
|
|
10
9
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
11
10
|
*/
|
|
12
11
|
export const WFSSource = {
|
|
@@ -16,18 +15,14 @@ export const WFSSource = {
|
|
|
16
15
|
version: '0.0.0',
|
|
17
16
|
extensions: [],
|
|
18
17
|
mimeTypes: [],
|
|
19
|
-
options: {
|
|
20
|
-
url: undefined,
|
|
21
|
-
wfs: {
|
|
22
|
-
/** Tabular loaders, normally the GeoJSONLoader */
|
|
23
|
-
loaders: []
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
18
|
type: 'wfs',
|
|
27
19
|
fromUrl: true,
|
|
28
20
|
fromBlob: false,
|
|
21
|
+
defaultOptions: {
|
|
22
|
+
wfs: {}
|
|
23
|
+
},
|
|
29
24
|
testURL: (url) => url.toLowerCase().includes('wfs'),
|
|
30
|
-
createDataSource: (url,
|
|
25
|
+
createDataSource: (url, options) => new WFSVectorSource(url, options)
|
|
31
26
|
};
|
|
32
27
|
//
|
|
33
28
|
/**
|
|
@@ -37,43 +32,16 @@ export const WFSSource = {
|
|
|
37
32
|
* - implements the VectorSource interface
|
|
38
33
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
39
34
|
*/
|
|
40
|
-
export class WFSVectorSource extends
|
|
41
|
-
/** Base URL to the service */
|
|
42
|
-
url;
|
|
43
|
-
data;
|
|
44
|
-
// /** In WFS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
|
|
45
|
-
// substituteCRS84: boolean;
|
|
46
|
-
// /** In WFS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */
|
|
47
|
-
// flipCRS: string[];
|
|
48
|
-
// /** Default static WFS parameters */
|
|
49
|
-
// wmsParameters: Required<WFSParameters>;
|
|
35
|
+
export class WFSVectorSource extends DataSource {
|
|
50
36
|
/** Default static vendor parameters */
|
|
51
37
|
vendorParameters;
|
|
52
38
|
capabilities = null;
|
|
53
39
|
/** Create a WFSVectorSource */
|
|
54
|
-
constructor(
|
|
55
|
-
super(
|
|
40
|
+
constructor(data, options) {
|
|
41
|
+
super(data, options, WFSSource.defaultOptions);
|
|
56
42
|
// TODO - defaults such as version, layers etc could be extracted from a base URL with parameters
|
|
57
43
|
// This would make pasting in any WFS URL more likely to make this class just work.
|
|
58
|
-
// const {baseUrl, parameters} = this._parseWFSUrl(
|
|
59
|
-
this.url = props.url;
|
|
60
|
-
this.data = props.url;
|
|
61
|
-
// this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
62
|
-
// this.flipCRS = ['EPSG:4326'];
|
|
63
|
-
// this.wmsParameters = {
|
|
64
|
-
// layers: undefined!,
|
|
65
|
-
// query_layers: undefined!,
|
|
66
|
-
// styles: undefined,
|
|
67
|
-
// version: '1.3.0',
|
|
68
|
-
// crs: 'EPSG:4326',
|
|
69
|
-
// format: 'image/png',
|
|
70
|
-
// info_format: 'text/plain',
|
|
71
|
-
// transparent: undefined!,
|
|
72
|
-
// time: undefined!,
|
|
73
|
-
// elevation: undefined!,
|
|
74
|
-
// ...props.wmsParameters
|
|
75
|
-
// };
|
|
76
|
-
// this.vendorParameters = props.vendorParameters || {};
|
|
44
|
+
// const {baseUrl, parameters} = this._parseWFSUrl(options.url);
|
|
77
45
|
}
|
|
78
46
|
async getSchema() {
|
|
79
47
|
return { metadata: {}, fields: [] };
|
|
@@ -86,7 +54,7 @@ export class WFSVectorSource extends VectorSource {
|
|
|
86
54
|
async getFeatures(parameters) {
|
|
87
55
|
// Replace the GetImage `boundingBox` parameter with the WFS flat `bbox` parameter.
|
|
88
56
|
// const {boundingBox, bbox, ...rest} = parameters;
|
|
89
|
-
// const
|
|
57
|
+
// const wfsParameters: WFSGetMapParameters = {
|
|
90
58
|
// bbox: boundingBox ? [...boundingBox[0], ...boundingBox[1]] : bbox!,
|
|
91
59
|
// ...rest
|
|
92
60
|
// };
|
|
@@ -97,8 +65,8 @@ export class WFSVectorSource extends VectorSource {
|
|
|
97
65
|
}
|
|
98
66
|
// WFS Service API Stubs
|
|
99
67
|
/** Get Capabilities */
|
|
100
|
-
async getCapabilities(
|
|
101
|
-
const url = this.getCapabilitiesURL(
|
|
68
|
+
async getCapabilities(wfsParameters, vendorParameters) {
|
|
69
|
+
const url = this.getCapabilitiesURL(wfsParameters, vendorParameters);
|
|
102
70
|
const response = await this.fetch(url);
|
|
103
71
|
const arrayBuffer = await response.arrayBuffer();
|
|
104
72
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -108,10 +76,10 @@ export class WFSVectorSource extends VectorSource {
|
|
|
108
76
|
}
|
|
109
77
|
/** Get a map image *
|
|
110
78
|
async getMap(
|
|
111
|
-
|
|
79
|
+
wfsParameters: WFSGetMapParameters,
|
|
112
80
|
vendorParameters?: Record<string, unknown>
|
|
113
81
|
): Promise<ImageType> {
|
|
114
|
-
const url = this.getMapURL(
|
|
82
|
+
const url = this.getMapURL(wfsParameters, vendorParameters);
|
|
115
83
|
const response = await this.fetch(url);
|
|
116
84
|
const arrayBuffer = await response.arrayBuffer();
|
|
117
85
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -124,10 +92,10 @@ export class WFSVectorSource extends VectorSource {
|
|
|
124
92
|
|
|
125
93
|
/** Get Feature Info for a coordinate *
|
|
126
94
|
async getFeatureInfo(
|
|
127
|
-
|
|
95
|
+
wfsParameters: WFSGetFeatureInfoParameters,
|
|
128
96
|
vendorParameters?: Record<string, unknown>
|
|
129
97
|
): Promise<WFSFeatureInfo> {
|
|
130
|
-
const url = this.getFeatureInfoURL(
|
|
98
|
+
const url = this.getFeatureInfoURL(wfsParameters, vendorParameters);
|
|
131
99
|
const response = await this.fetch(url);
|
|
132
100
|
const arrayBuffer = await response.arrayBuffer();
|
|
133
101
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -136,10 +104,10 @@ export class WFSVectorSource extends VectorSource {
|
|
|
136
104
|
|
|
137
105
|
/** Get Feature Info for a coordinate *
|
|
138
106
|
async getFeatureInfoText(
|
|
139
|
-
|
|
107
|
+
wfsParameters: WFSGetFeatureInfoParameters,
|
|
140
108
|
vendorParameters?: Record<string, unknown>
|
|
141
109
|
): Promise<string> {
|
|
142
|
-
const url = this.getFeatureInfoURL(
|
|
110
|
+
const url = this.getFeatureInfoURL(wfsParameters, vendorParameters);
|
|
143
111
|
const response = await this.fetch(url);
|
|
144
112
|
const arrayBuffer = await response.arrayBuffer();
|
|
145
113
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -148,10 +116,10 @@ export class WFSVectorSource extends VectorSource {
|
|
|
148
116
|
|
|
149
117
|
/** Get more information about a layer *
|
|
150
118
|
async describeLayer(
|
|
151
|
-
|
|
119
|
+
wfsParameters: WFSDescribeLayerParameters,
|
|
152
120
|
vendorParameters?: Record<string, unknown>
|
|
153
121
|
): Promise<WFSLayerDescription> {
|
|
154
|
-
const url = this.describeLayerURL(
|
|
122
|
+
const url = this.describeLayerURL(wfsParameters, vendorParameters);
|
|
155
123
|
const response = await this.fetch(url);
|
|
156
124
|
const arrayBuffer = await response.arrayBuffer();
|
|
157
125
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -160,10 +128,10 @@ export class WFSVectorSource extends VectorSource {
|
|
|
160
128
|
|
|
161
129
|
/** Get an image with a semantic legend *
|
|
162
130
|
async getLegendGraphic(
|
|
163
|
-
|
|
131
|
+
wfsParameters: WFSGetLegendGraphicParameters,
|
|
164
132
|
vendorParameters?: Record<string, unknown>
|
|
165
133
|
): Promise<ImageType> {
|
|
166
|
-
const url = this.getLegendGraphicURL(
|
|
134
|
+
const url = this.getLegendGraphicURL(wfsParameters, vendorParameters);
|
|
167
135
|
const response = await this.fetch(url);
|
|
168
136
|
const arrayBuffer = await response.arrayBuffer();
|
|
169
137
|
this._checkResponse(response, arrayBuffer);
|
|
@@ -177,74 +145,74 @@ export class WFSVectorSource extends VectorSource {
|
|
|
177
145
|
// Typed URL creators
|
|
178
146
|
// For applications that want full control of fetching and parsing
|
|
179
147
|
/** Generate a URL for the GetCapabilities request */
|
|
180
|
-
getCapabilitiesURL(
|
|
148
|
+
getCapabilitiesURL(wfsParameters, vendorParameters) {
|
|
181
149
|
// @ts-expect-error
|
|
182
150
|
const options = {
|
|
183
|
-
// version: this.
|
|
184
|
-
...
|
|
151
|
+
// version: this.wfsParameters.version,
|
|
152
|
+
...wfsParameters
|
|
185
153
|
};
|
|
186
154
|
return this._getWFSUrl('GetCapabilities', options, vendorParameters);
|
|
187
155
|
}
|
|
188
156
|
/** Generate a URL for the GetMap request */
|
|
189
|
-
getMapURL(
|
|
190
|
-
|
|
157
|
+
getMapURL(wfsParameters, vendorParameters) {
|
|
158
|
+
wfsParameters = this._getWFS130Parameters(wfsParameters);
|
|
191
159
|
// @ts-expect-error
|
|
192
160
|
const options = {
|
|
193
|
-
// version: this.
|
|
194
|
-
// format: this.
|
|
195
|
-
// transparent: this.
|
|
196
|
-
// time: this.
|
|
197
|
-
// elevation: this.
|
|
198
|
-
// layers: this.
|
|
199
|
-
// styles: this.
|
|
200
|
-
// crs: this.
|
|
161
|
+
// version: this.wfsParameters.version,
|
|
162
|
+
// format: this.wfsParameters.format,
|
|
163
|
+
// transparent: this.wfsParameters.transparent,
|
|
164
|
+
// time: this.wfsParameters.time,
|
|
165
|
+
// elevation: this.wfsParameters.elevation,
|
|
166
|
+
// layers: this.wfsParameters.layers,
|
|
167
|
+
// styles: this.wfsParameters.styles,
|
|
168
|
+
// crs: this.wfsParameters.crs,
|
|
201
169
|
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
202
170
|
// width: 1200,
|
|
203
171
|
// height: 900,
|
|
204
|
-
...
|
|
172
|
+
...wfsParameters
|
|
205
173
|
};
|
|
206
174
|
return this._getWFSUrl('GetMap', options, vendorParameters);
|
|
207
175
|
}
|
|
208
176
|
/** Generate a URL for the GetFeatureInfo request */
|
|
209
|
-
getFeatureInfoURL(
|
|
210
|
-
|
|
177
|
+
getFeatureInfoURL(wfsParameters, vendorParameters) {
|
|
178
|
+
wfsParameters = this._getWFS130Parameters(wfsParameters);
|
|
211
179
|
// Replace the GetImage `boundingBox` parameter with the WFS flat `bbox` parameter.
|
|
212
|
-
const { boundingBox, bbox } =
|
|
213
|
-
|
|
180
|
+
const { boundingBox, bbox } = wfsParameters;
|
|
181
|
+
wfsParameters.bbox = boundingBox ? [...boundingBox[0], ...boundingBox[1]] : bbox;
|
|
214
182
|
// @ts-expect-error
|
|
215
183
|
const options = {
|
|
216
|
-
// version: this.
|
|
184
|
+
// version: this.wfsParameters.version,
|
|
217
185
|
// // query_layers: [],
|
|
218
|
-
// // format: this.
|
|
219
|
-
// info_format: this.
|
|
220
|
-
// layers: this.
|
|
221
|
-
// query_layers: this.
|
|
222
|
-
// styles: this.
|
|
223
|
-
// crs: this.
|
|
186
|
+
// // format: this.wfsParameters.format,
|
|
187
|
+
// info_format: this.wfsParameters.info_format,
|
|
188
|
+
// layers: this.wfsParameters.layers,
|
|
189
|
+
// query_layers: this.wfsParameters.query_layers,
|
|
190
|
+
// styles: this.wfsParameters.styles,
|
|
191
|
+
// crs: this.wfsParameters.crs,
|
|
224
192
|
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
225
193
|
// width: 1200,
|
|
226
194
|
// height: 900,
|
|
227
195
|
// x: undefined!,
|
|
228
196
|
// y: undefined!,
|
|
229
|
-
...
|
|
197
|
+
...wfsParameters
|
|
230
198
|
};
|
|
231
199
|
return this._getWFSUrl('GetFeatureInfo', options, vendorParameters);
|
|
232
200
|
}
|
|
233
201
|
/** Generate a URL for the GetFeatureInfo request */
|
|
234
|
-
describeLayerURL(
|
|
202
|
+
describeLayerURL(wfsParameters, vendorParameters) {
|
|
235
203
|
// @ts-expect-error
|
|
236
204
|
const options = {
|
|
237
|
-
// version: this.
|
|
238
|
-
...
|
|
205
|
+
// version: this.wfsParameters.version,
|
|
206
|
+
...wfsParameters
|
|
239
207
|
};
|
|
240
208
|
return this._getWFSUrl('DescribeLayer', options, vendorParameters);
|
|
241
209
|
}
|
|
242
|
-
getLegendGraphicURL(
|
|
210
|
+
getLegendGraphicURL(wfsParameters, vendorParameters) {
|
|
243
211
|
// @ts-expect-error
|
|
244
212
|
const options = {
|
|
245
|
-
// version: this.
|
|
213
|
+
// version: this.wfsParameters.version,
|
|
246
214
|
// format?
|
|
247
|
-
...
|
|
215
|
+
...wfsParameters
|
|
248
216
|
};
|
|
249
217
|
return this._getWFSUrl('GetLegendGraphic', options, vendorParameters);
|
|
250
218
|
}
|
|
@@ -264,15 +232,15 @@ export class WFSVectorSource extends VectorSource {
|
|
|
264
232
|
* @note case _getWFSUrl may need to be overridden to handle certain backends?
|
|
265
233
|
* @note at the moment, only URLs with parameters are supported (no XML payloads)
|
|
266
234
|
* */
|
|
267
|
-
_getWFSUrl(request,
|
|
235
|
+
_getWFSUrl(request, wfsParameters, vendorParameters) {
|
|
268
236
|
let url = this.url;
|
|
269
237
|
let first = true;
|
|
270
238
|
// Add any vendor searchParams
|
|
271
239
|
const allParameters = {
|
|
272
240
|
service: 'WFS',
|
|
273
|
-
version:
|
|
241
|
+
version: wfsParameters.version,
|
|
274
242
|
request,
|
|
275
|
-
...
|
|
243
|
+
...wfsParameters,
|
|
276
244
|
...this.vendorParameters,
|
|
277
245
|
...vendorParameters
|
|
278
246
|
};
|
|
@@ -283,13 +251,13 @@ export class WFSVectorSource extends VectorSource {
|
|
|
283
251
|
if (!IGNORE_EMPTY_KEYS.includes(key) || value) {
|
|
284
252
|
url += first ? '?' : '&';
|
|
285
253
|
first = false;
|
|
286
|
-
url += this._getURLParameter(key, value,
|
|
254
|
+
url += this._getURLParameter(key, value, wfsParameters);
|
|
287
255
|
}
|
|
288
256
|
}
|
|
289
257
|
return encodeURI(url);
|
|
290
258
|
}
|
|
291
|
-
_getWFS130Parameters(
|
|
292
|
-
const newParameters = { ...
|
|
259
|
+
_getWFS130Parameters(wfsParameters) {
|
|
260
|
+
const newParameters = { ...wfsParameters };
|
|
293
261
|
if (newParameters.srs) {
|
|
294
262
|
newParameters.crs = newParameters.crs || newParameters.srs;
|
|
295
263
|
delete newParameters.srs;
|
|
@@ -297,12 +265,12 @@ export class WFSVectorSource extends VectorSource {
|
|
|
297
265
|
return newParameters;
|
|
298
266
|
}
|
|
299
267
|
// eslint-disable-next-line complexity
|
|
300
|
-
_getURLParameter(key, value,
|
|
268
|
+
_getURLParameter(key, value, wfsParameters) {
|
|
301
269
|
// Substitute by key
|
|
302
270
|
switch (key) {
|
|
303
271
|
case 'crs':
|
|
304
272
|
// CRS was called SRS before WFS 1.3.0
|
|
305
|
-
if (
|
|
273
|
+
if (wfsParameters.version !== '1.3.0') {
|
|
306
274
|
key = 'srs';
|
|
307
275
|
// } else if (this.substituteCRS84 && value === 'EPSG:4326') {
|
|
308
276
|
// /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */
|
|
@@ -312,13 +280,13 @@ export class WFSVectorSource extends VectorSource {
|
|
|
312
280
|
break;
|
|
313
281
|
case 'srs':
|
|
314
282
|
// CRS was called SRS before WFS 1.3.0
|
|
315
|
-
if (
|
|
283
|
+
if (wfsParameters.version === '1.3.0') {
|
|
316
284
|
key = 'crs';
|
|
317
285
|
}
|
|
318
286
|
break;
|
|
319
287
|
case 'bbox':
|
|
320
288
|
// Coordinate order is flipped for certain CRS in WFS 1.3.0
|
|
321
|
-
const bbox = this._flipBoundingBox(value,
|
|
289
|
+
const bbox = this._flipBoundingBox(value, wfsParameters);
|
|
322
290
|
if (bbox) {
|
|
323
291
|
value = bbox;
|
|
324
292
|
}
|
|
@@ -326,14 +294,14 @@ export class WFSVectorSource extends VectorSource {
|
|
|
326
294
|
case 'x':
|
|
327
295
|
// i is the parameter used in WFS 1.3
|
|
328
296
|
// TODO - change parameter to `i` and convert to `x` if not 1.3
|
|
329
|
-
if (
|
|
297
|
+
if (wfsParameters.version === '1.3.0') {
|
|
330
298
|
key = 'i';
|
|
331
299
|
}
|
|
332
300
|
break;
|
|
333
301
|
case 'y':
|
|
334
302
|
// j is the parameter used in WFS 1.3
|
|
335
303
|
// TODO - change parameter to `j` and convert to `y` if not 1.3
|
|
336
|
-
if (
|
|
304
|
+
if (wfsParameters.version === '1.3.0') {
|
|
337
305
|
key = 'j';
|
|
338
306
|
}
|
|
339
307
|
break;
|
|
@@ -346,18 +314,18 @@ export class WFSVectorSource extends VectorSource {
|
|
|
346
314
|
: `${key}=${value ? String(value) : ''}`;
|
|
347
315
|
}
|
|
348
316
|
/** Coordinate order is flipped for certain CRS in WFS 1.3.0 */
|
|
349
|
-
_flipBoundingBox(bboxValue,
|
|
317
|
+
_flipBoundingBox(bboxValue, wfsParameters) {
|
|
350
318
|
// Sanity checks
|
|
351
319
|
if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
|
|
352
320
|
return null;
|
|
353
321
|
}
|
|
354
322
|
const flipCoordinates = false;
|
|
355
323
|
// // Only affects WFS 1.3.0
|
|
356
|
-
//
|
|
324
|
+
// wfsParameters.version === '1.3.0' &&
|
|
357
325
|
// // Flip if we are dealing with a CRS that was flipped in 1.3.0
|
|
358
|
-
// this.flipCRS.includes(
|
|
326
|
+
// this.flipCRS.includes(wfsParameters.crs || '') &&
|
|
359
327
|
// // Don't flip if we are substituting EPSG:4326 with CRS:84
|
|
360
|
-
// !(this.substituteCRS84 &&
|
|
328
|
+
// !(this.substituteCRS84 && wfsParameters.crs === 'EPSG:4326');
|
|
361
329
|
const bbox = bboxValue;
|
|
362
330
|
return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
|
|
363
331
|
}
|
|
@@ -373,7 +341,7 @@ export class WFSVectorSource extends VectorSource {
|
|
|
373
341
|
const contentType = response.headers['content-type'];
|
|
374
342
|
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
375
343
|
// We want error responses to throw exceptions, the WMSErrorLoader can do this
|
|
376
|
-
const loadOptions =
|
|
344
|
+
const loadOptions = mergeOptions(this.loadOptions, {
|
|
377
345
|
wms: { throwOnError: true }
|
|
378
346
|
});
|
|
379
347
|
const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);
|