ol-wfst 4.0.0 → 4.0.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.
Files changed (50) hide show
  1. package/README.md +221 -127
  2. package/dist/@types.d.ts +32 -0
  3. package/dist/@types.d.ts.map +1 -1
  4. package/dist/WfsLayer.d.ts +15 -2
  5. package/dist/WfsLayer.d.ts.map +1 -1
  6. package/dist/WmsLayer.d.ts +16 -3
  7. package/dist/WmsLayer.d.ts.map +1 -1
  8. package/dist/modules/{Modes/baseLayer.d.ts → base/BaseLayer.d.ts} +1 -1
  9. package/dist/modules/base/BaseLayer.d.ts.map +1 -0
  10. package/dist/modules/base/WfsSource.d.ts +48 -0
  11. package/dist/modules/base/WfsSource.d.ts.map +1 -0
  12. package/dist/modules/base/WmsSource.d.ts +47 -0
  13. package/dist/modules/base/WmsSource.d.ts.map +1 -0
  14. package/dist/modules/errors.d.ts.map +1 -1
  15. package/dist/ol-wfst.js +78 -321
  16. package/dist/ol-wfst.js.map +1 -1
  17. package/dist/ol-wfst.min.js +1 -1
  18. package/dist/ol-wfst.min.js.map +1 -1
  19. package/lib/@types.d.ts +32 -0
  20. package/lib/@types.d.ts.map +1 -1
  21. package/lib/WfsLayer.d.ts +15 -2
  22. package/lib/WfsLayer.d.ts.map +1 -1
  23. package/lib/WmsLayer.d.ts +16 -3
  24. package/lib/WmsLayer.d.ts.map +1 -1
  25. package/lib/index-es.js +74 -317
  26. package/lib/index-es.js.map +1 -1
  27. package/lib/modules/{Modes/baseLayer.d.ts → base/BaseLayer.d.ts} +1 -1
  28. package/lib/modules/base/BaseLayer.d.ts.map +1 -0
  29. package/lib/modules/base/WfsSource.d.ts +48 -0
  30. package/lib/modules/base/WfsSource.d.ts.map +1 -0
  31. package/lib/modules/base/WmsSource.d.ts +47 -0
  32. package/lib/modules/base/WmsSource.d.ts.map +1 -0
  33. package/lib/modules/errors.d.ts.map +1 -1
  34. package/lib/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/dist/modules/Modes/WfsSource.d.ts +0 -60
  37. package/dist/modules/Modes/WfsSource.d.ts.map +0 -1
  38. package/dist/modules/Modes/WmsSource.d.ts +0 -82
  39. package/dist/modules/Modes/WmsSource.d.ts.map +0 -1
  40. package/dist/modules/Modes/baseLayer.d.ts.map +0 -1
  41. package/dist/modules/Modes/baseSource.d.ts +0 -103
  42. package/dist/modules/Modes/baseSource.d.ts.map +0 -1
  43. package/dist/tsconfig.tsbuildinfo +0 -1
  44. package/lib/modules/Modes/WfsSource.d.ts +0 -60
  45. package/lib/modules/Modes/WfsSource.d.ts.map +0 -1
  46. package/lib/modules/Modes/WmsSource.d.ts +0 -82
  47. package/lib/modules/Modes/WmsSource.d.ts.map +0 -1
  48. package/lib/modules/Modes/baseLayer.d.ts.map +0 -1
  49. package/lib/modules/Modes/baseSource.d.ts +0 -103
  50. package/lib/modules/Modes/baseSource.d.ts.map +0 -1
@@ -0,0 +1,48 @@
1
+ import VectorSource, { Options as VSOptions } from 'ol/source/Vector';
2
+ import { WfsGeoserverVendor } from '../../@types';
3
+ import { GeoServerAdvanced } from '../../Geoserver';
4
+ /**
5
+ * Layer source to retrieve WFS features from geoservers
6
+ * https://docs.geoserver.org/stable/en/user/services/wfs/reference.html
7
+ *
8
+ * @extends {ol/source/Vector~VectorSource}
9
+ * @param options
10
+ */
11
+ export default class WfsSource extends VectorSource {
12
+ urlParams: URLSearchParams;
13
+ constructor(options: WfsSourceOptions);
14
+ }
15
+ /**
16
+ * **_[interface]_** - Parameters to create a WfsSource
17
+ *
18
+ * @public
19
+ */
20
+ export interface WfsSourceOptions extends VSOptions {
21
+ /**
22
+ * Layer name in the GeoServer
23
+ */
24
+ name: string;
25
+ /**
26
+ * Url for OWS services. This endpoint will recive the WFS, WFST and WMS requests
27
+ */
28
+ geoserverUrl: string;
29
+ /**
30
+ * Advanced options for geoserver requests
31
+ */
32
+ geoServerAdvanced?: GeoServerAdvanced;
33
+ /**
34
+ *
35
+ */
36
+ geoserverVendor?: WfsGeoserverVendor;
37
+ /**
38
+ * Url headers for GeoServer requests. You can use it to add Authorization credentials
39
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/headers
40
+ */
41
+ headers?: HeadersInit;
42
+ /**
43
+ * Credentials for fetch requests
44
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
45
+ */
46
+ credentials?: RequestCredentials;
47
+ }
48
+ //# sourceMappingURL=WfsSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WfsSource.d.ts","sourceRoot":"","sources":["../../../src/modules/base/WfsSource.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,EAAE,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAItE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,YAAY;IACxC,SAAS,kBAKb;gBAES,OAAO,EAAE,gBAAgB;CAoFxC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IAC/C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAErC;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC"}
@@ -0,0 +1,47 @@
1
+ import TileWMS, { Options as TSOptions } from 'ol/source/TileWMS';
2
+ import { WmsGeoserverVendor } from '../../@types';
3
+ import { GeoServerAdvanced } from '../../Geoserver';
4
+ /**
5
+ * Layer source to retrieve WMS information from geoservers
6
+ * https://docs.geoserver.org/stable/en/user/services/wms/reference.html
7
+ *
8
+ * @extends {ol/source/TieWMS~TileWMS}
9
+ * @param options
10
+ */
11
+ export default class WmsSource extends TileWMS {
12
+ constructor(options: WmsSourceOptions);
13
+ }
14
+ /**
15
+ * **_[interface]_** - Parameters to create a WmsSource
16
+ *
17
+ * @public
18
+ */
19
+ export interface WmsSourceOptions extends Omit<TSOptions, 'params'> {
20
+ /**
21
+ * Layer name in the GeoServer
22
+ */
23
+ name: string;
24
+ /**
25
+ * Url for OWS services. This endpoint will recive the WFS, WFST and WMS requests
26
+ */
27
+ geoserverUrl: string;
28
+ /**
29
+ * Advanced options for geoserver requests
30
+ */
31
+ geoServerAdvanced?: GeoServerAdvanced;
32
+ /**
33
+ *
34
+ */
35
+ geoserverVendor?: WmsGeoserverVendor;
36
+ /**
37
+ * Url headers for GeoServer requests. You can use it to add Authorization credentials
38
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/headers
39
+ */
40
+ headers?: HeadersInit;
41
+ /**
42
+ * Credentials for fetch requests
43
+ * https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
44
+ */
45
+ credentials?: RequestCredentials;
46
+ }
47
+ //# sourceMappingURL=WmsSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WmsSource.d.ts","sourceRoot":"","sources":["../../../src/modules/base/WmsSource.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;gBAC9B,OAAO,EAAE,gBAAgB;CAmDxC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC/D;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAErC;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/modules/errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,eAAO,MAAM,SAAS,SAAU,OAAO,CAAC,OAAO,CAAC,SAE/C,CAAC;AAEF,eAAO,MAAM,UAAU,8BAMtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QACb,MAAM,kBACI,KAAK,yBAErB,IAqBF,CAAC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/modules/errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,eAAO,MAAM,SAAS,SAAU,OAAO,CAAC,OAAO,CAAC,SAE/C,CAAC;AAEF,eAAO,MAAM,UAAU,8BAMtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,QACb,MAAM,kBACI,KAAK,yBAErB,IAoBF,CAAC"}
package/dist/ol-wfst.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ol/style'), require('ol/control'), require('ol/interaction'), require('ol/events/Event'), require('ol/events/condition'), require('ol/Observable'), require('ol/layer/Vector'), require('ol/layer/Base'), require('ol/format/GeoJSON'), require('ol/source/Vector'), require('ol/proj'), require('ol/loadingstrategy'), require('ol/Object'), require('ol/layer/Tile'), require('ol/format'), require('ol/source/TileWMS'), require('ol/geom'), require('ol/geom/Polygon'), require('ol/extent')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'ol/style', 'ol/control', 'ol/interaction', 'ol/events/Event', 'ol/events/condition', 'ol/Observable', 'ol/layer/Vector', 'ol/layer/Base', 'ol/format/GeoJSON', 'ol/source/Vector', 'ol/proj', 'ol/loadingstrategy', 'ol/Object', 'ol/layer/Tile', 'ol/format', 'ol/source/TileWMS', 'ol/geom', 'ol/geom/Polygon', 'ol/extent'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Wfst = {}, global.ol.style, global.ol.control, global.ol.interaction, global.ol.events.Event, global.ol.events.condition, global.ol.Observable, global.ol.layer.Vector, global.ol.layer.Base, global.ol.format.GeoJSON, global.ol.source.Vector, global.ol.proj, global.ol.loadingstrategy, global.ol.Object, global.ol.layer.Tile, global.ol.format, global.ol.source.TileWMS, global.ol.geom, global.ol.geom.Polygon, global.ol.extent));
5
- })(this, (function (exports, style, control, interaction, BaseEvent$1, condition, Observable$2, VectorLayer, Layer, GeoJSON, VectorSource, proj, loadingstrategy, BaseObject$2, TileLayer, format, TileWMS, geom, Polygon, extent) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ol/style'), require('ol/control'), require('ol/interaction'), require('ol/events/Event'), require('ol/events/condition'), require('ol/Observable'), require('ol/layer/Vector'), require('ol/layer/Base'), require('ol/format/GeoJSON'), require('ol/source/Vector'), require('ol/proj'), require('ol/loadingstrategy'), require('ol/layer/Tile'), require('ol/format'), require('ol/source/TileWMS'), require('ol/geom'), require('ol/Object'), require('ol/geom/Polygon'), require('ol/extent')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'ol/style', 'ol/control', 'ol/interaction', 'ol/events/Event', 'ol/events/condition', 'ol/Observable', 'ol/layer/Vector', 'ol/layer/Base', 'ol/format/GeoJSON', 'ol/source/Vector', 'ol/proj', 'ol/loadingstrategy', 'ol/layer/Tile', 'ol/format', 'ol/source/TileWMS', 'ol/geom', 'ol/Object', 'ol/geom/Polygon', 'ol/extent'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Wfst = {}, global.ol.style, global.ol.control, global.ol.interaction, global.ol.events.Event, global.ol.events.condition, global.ol.Observable, global.ol.layer.Vector, global.ol.layer.Base, global.ol.format.GeoJSON, global.ol.source.Vector, global.ol.proj, global.ol.loadingstrategy, global.ol.layer.Tile, global.ol.format, global.ol.source.TileWMS, global.ol.geom, global.ol.Object, global.ol.geom.Polygon, global.ol.extent));
5
+ })(this, (function (exports, style, control, interaction, BaseEvent$1, condition, Observable$2, VectorLayer, Layer, GeoJSON, VectorSource, proj, loadingstrategy, TileLayer, format, TileWMS, geom, BaseObject$2, Polygon, extent) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -11,9 +11,9 @@
11
11
  var Layer__default = /*#__PURE__*/_interopDefaultLegacy(Layer);
12
12
  var GeoJSON__default = /*#__PURE__*/_interopDefaultLegacy(GeoJSON);
13
13
  var VectorSource__default = /*#__PURE__*/_interopDefaultLegacy(VectorSource);
14
- var BaseObject__default = /*#__PURE__*/_interopDefaultLegacy(BaseObject$2);
15
14
  var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
16
15
  var TileWMS__default = /*#__PURE__*/_interopDefaultLegacy(TileWMS);
16
+ var BaseObject__default = /*#__PURE__*/_interopDefaultLegacy(BaseObject$2);
17
17
 
18
18
  /**
19
19
  * @module ol/AssertionError
@@ -3776,8 +3776,7 @@
3776
3776
  isError.add(layerName);
3777
3777
  let err_msg = `<b>Error: ${msg}</b>`;
3778
3778
  if (originalError) {
3779
- console.log(originalError);
3780
- //err_msg += `. ${originalError.message}`;
3779
+ err_msg += `. ${originalError.message}`;
3781
3780
  }
3782
3781
  const al = Modal.alert(err_msg, options);
3783
3782
  al.show();
@@ -4296,153 +4295,15 @@
4296
4295
  BaseLayerProperty["GEOSERVER"] = "geoserver";
4297
4296
  })(BaseLayerProperty || (BaseLayerProperty = {}));
4298
4297
 
4299
- class BaseSource extends BaseObject__default["default"] {
4300
- /**
4301
- * @public
4302
- * @param value
4303
- * @param opt_silent
4304
- */
4305
- setCqlFilter(value, opt_silent) {
4306
- this.set(BaseSourceProperty.CQLFILTER, value, opt_silent);
4307
- }
4308
- /**
4309
- * @public
4310
- * @returns
4311
- */
4312
- getCqlFilter() {
4313
- return this.get(BaseSourceProperty.CQLFILTER);
4314
- }
4315
- /**
4316
- * @public
4317
- * @param value
4318
- * @param opt_silent
4319
- */
4320
- setSortBy(value, opt_silent) {
4321
- this.set(BaseSourceProperty.SORTBY, value, opt_silent);
4322
- }
4323
- /**
4324
- * @public
4325
- * @returns
4326
- */
4327
- getSortBy() {
4328
- return this.get(BaseSourceProperty.SORTBY);
4329
- }
4330
- /**
4331
- * @public
4332
- * @param value
4333
- * @param opt_silent
4334
- */
4335
- setFeatureId(value, opt_silent) {
4336
- this.set(BaseSourceProperty.FEATUREID, value, opt_silent);
4337
- }
4338
- /**
4339
- * @public
4340
- * @returns
4341
- */
4342
- getFeatureId() {
4343
- return this.get(BaseSourceProperty.FEATUREID);
4344
- }
4345
- /**
4346
- * @public
4347
- * @param value
4348
- * @param opt_silent
4349
- */
4350
- setFilter(value, opt_silent) {
4351
- this.set(BaseSourceProperty.FILTER, value, opt_silent);
4352
- }
4353
- /**
4354
- * @public
4355
- * @returns
4356
- */
4357
- getFilter() {
4358
- return this.get(BaseSourceProperty.FILTER);
4359
- }
4360
- /**
4361
- * @public
4362
- * @param value
4363
- * @param opt_silent
4364
- */
4365
- setFormatOptions(value, opt_silent) {
4366
- this.set(BaseSourceProperty.FORMATOPTIONS, value, opt_silent);
4367
- }
4368
- /**
4369
- * @public
4370
- * @returns
4371
- */
4372
- getFormatOptions() {
4373
- return this.get(BaseSourceProperty.FORMATOPTIONS);
4374
- }
4375
- /**
4376
- * @public
4377
- * @param value
4378
- * @param opt_silent
4379
- */
4380
- setMaxFeatures(value, opt_silent) {
4381
- this.set(BaseSourceProperty.MAXFEATURES, value, opt_silent);
4382
- }
4383
- /**
4384
- * @public
4385
- * @returns
4386
- */
4387
- getMaxFeatures() {
4388
- return this.get(BaseSourceProperty.MAXFEATURES);
4389
- }
4390
- /**
4391
- * @public
4392
- * @param value
4393
- * @param opt_silent
4394
- */
4395
- setStartIndex(value, opt_silent) {
4396
- this.set(BaseSourceProperty.STARTINDEX, value, opt_silent);
4397
- }
4398
- /**
4399
- * @public
4400
- * @returns
4401
- */
4402
- getStartIndex() {
4403
- return this.get(BaseSourceProperty.STARTINDEX);
4404
- }
4405
- /**
4406
- * @public
4407
- * @param value
4408
- * @param opt_silent
4409
- */
4410
- setPropertyName(value, opt_silent) {
4411
- this.set(BaseSourceProperty.PROPERTYNAME, value, opt_silent);
4412
- }
4413
- /**
4414
- * @public
4415
- * @returns
4416
- */
4417
- getPropertyName() {
4418
- return this.get(BaseSourceProperty.PROPERTYNAME);
4419
- }
4420
- }
4421
- var BaseSourceProperty;
4422
- (function (BaseSourceProperty) {
4423
- BaseSourceProperty["CQLFILTER"] = "cql_filter";
4424
- BaseSourceProperty["SORTBY"] = "sortBy";
4425
- BaseSourceProperty["FEATUREID"] = "featureid";
4426
- BaseSourceProperty["FILTER"] = "filter";
4427
- BaseSourceProperty["FORMATOPTIONS"] = "format_options";
4428
- BaseSourceProperty["MAXFEATURES"] = "maxFeatures";
4429
- BaseSourceProperty["STARTINDEX"] = "startIndex";
4430
- BaseSourceProperty["PROPERTYNAME"] = "propertyname";
4431
- })(BaseSourceProperty || (BaseSourceProperty = {}));
4432
-
4433
- class WfsSource extends Mixin(VectorSource__default["default"], BaseSource) {
4434
- geoserverProps_ = [
4435
- 'cql_filter',
4436
- 'filter',
4437
- 'orderBy',
4438
- 'maxFeatures',
4439
- 'startIndex',
4440
- 'featureid',
4441
- 'format_options',
4442
- 'propertyname',
4443
- 'strict'
4444
- ];
4445
- urlParams_ = new URLSearchParams({
4298
+ /**
4299
+ * Layer source to retrieve WFS features from geoservers
4300
+ * https://docs.geoserver.org/stable/en/user/services/wfs/reference.html
4301
+ *
4302
+ * @extends {ol/source/Vector~VectorSource}
4303
+ * @param options
4304
+ */
4305
+ class WfsSource extends VectorSource__default["default"] {
4306
+ urlParams = new URLSearchParams({
4446
4307
  SERVICE: 'wfs',
4447
4308
  REQUEST: 'GetFeature',
4448
4309
  OUTPUTFORMAT: 'application/json',
@@ -4459,46 +4320,10 @@
4459
4320
  const extentGeoServer = proj.transformExtent(extent, projection.getCode(), options.geoServerAdvanced.projection);
4460
4321
  // https://docs.geoserver.org/stable/en/user/services/wfs/reference.html
4461
4322
  // request features using a bounding box with CRS maybe different from featureTypes native CRS
4462
- this.urlParams_.set('bbox', extentGeoServer.toString() +
4323
+ this.urlParams.set('bbox', extentGeoServer.toString() +
4463
4324
  `,${options.geoServerAdvanced.projection}`);
4464
4325
  }
4465
- const cqlFilter = this.getCqlFilter();
4466
- if (cqlFilter) {
4467
- this.urlParams_.set('cql_filter', cqlFilter);
4468
- }
4469
- const sortBy = this.getSortBy();
4470
- if (sortBy) {
4471
- this.urlParams_.set('sortBy', sortBy);
4472
- }
4473
- const filter = this.getFilter();
4474
- if (filter) {
4475
- this.urlParams_.set('filter', filter);
4476
- }
4477
- const featureId = this.getFeatureId();
4478
- if (featureId) {
4479
- this.urlParams_.set('featureid', featureId);
4480
- }
4481
- const formatOptions = this.getFormatOptions();
4482
- if (formatOptions) {
4483
- this.urlParams_.set('formatOptions', formatOptions);
4484
- }
4485
- const maxFeatures = this.getMaxFeatures();
4486
- if (maxFeatures) {
4487
- this.urlParams_.set('maxFeatures', String(maxFeatures));
4488
- }
4489
- const startIndex = this.getStartIndex();
4490
- if (startIndex) {
4491
- this.urlParams_.set('startIndex', String(startIndex));
4492
- }
4493
- const propertyName = this.getPropertyName();
4494
- if (propertyName) {
4495
- this.urlParams_.set('propertyname', propertyName);
4496
- }
4497
- const strict = this.getStrict();
4498
- if (strict !== undefined) {
4499
- this.urlParams_.set('strict', String(strict));
4500
- }
4501
- const url_fetch = options.geoserverUrl + '?' + this.urlParams_.toString();
4326
+ const url_fetch = options.geoserverUrl + '?' + this.urlParams.toString();
4502
4327
  const response = await fetch(url_fetch, {
4503
4328
  headers: options.headers,
4504
4329
  credentials: options.credentials
@@ -4528,52 +4353,11 @@
4528
4353
  }
4529
4354
  }
4530
4355
  });
4531
- this.urlParams_.set('version', options.geoServerAdvanced.getFeatureVersion);
4532
- this.urlParams_.set('typename', options.name);
4533
- this.urlParams_.set('srsName', options.geoServerAdvanced.projection.toString());
4534
- const geoserverOptions = options.geoserverVendor;
4535
- this.setCqlFilter(geoserverOptions.cql_filter, true);
4536
- this.setSortBy(geoserverOptions.sortBy, true);
4537
- this.setFeatureId(geoserverOptions.featureid, true);
4538
- this.setFilter(geoserverOptions.filter, true);
4539
- this.setFormatOptions(geoserverOptions.format_options, true);
4540
- this.setMaxFeatures(geoserverOptions.maxFeatures, true);
4541
- this.setStartIndex(geoserverOptions.startIndex, true);
4542
- this.setPropertyName(geoserverOptions.propertyname, true);
4543
- this.setStrict(geoserverOptions.strict, true);
4544
- this.addEvents_();
4545
- }
4546
- /**
4547
- * @public
4548
- * @param value
4549
- * @param opt_silent
4550
- */
4551
- setStrict(value, opt_silent) {
4552
- this.set(WfsSourceProperty.STRICT, value, opt_silent);
4553
- }
4554
- /**
4555
- * @public
4556
- * @returns
4557
- */
4558
- getStrict() {
4559
- return this.get(WfsSourceProperty.STRICT);
4560
- }
4561
- /**
4562
- * @private
4563
- */
4564
- addEvents_() {
4565
- this.on(['propertychange'], (evt) => {
4566
- // If a geoserver property was modified, refresh the source
4567
- if (this.geoserverProps_.includes(evt.key)) {
4568
- this.refresh();
4569
- }
4570
- });
4356
+ this.urlParams.set('version', options.geoServerAdvanced.getFeatureVersion);
4357
+ this.urlParams.set('typename', options.name);
4358
+ this.urlParams.set('srsName', options.geoServerAdvanced.projection.toString());
4571
4359
  }
4572
- }
4573
- var WfsSourceProperty;
4574
- (function (WfsSourceProperty) {
4575
- WfsSourceProperty["STRICT"] = "strict";
4576
- })(WfsSourceProperty || (WfsSourceProperty = {}));
4360
+ }
4577
4361
 
4578
4362
  /**
4579
4363
  * Layer to retrieve WFS features from geoservers
@@ -4624,6 +4408,10 @@
4624
4408
  }
4625
4409
  });
4626
4410
  this.setSource(source);
4411
+ const geoserverOptions = options.geoserverVendor;
4412
+ Object.keys(geoserverOptions).forEach((param) => {
4413
+ source.urlParams.set(param, geoserverOptions[param]);
4414
+ });
4627
4415
  }
4628
4416
  /**
4629
4417
  * @public
@@ -4633,22 +4421,36 @@
4633
4421
  // Refrescamos el wms
4634
4422
  source.refresh();
4635
4423
  }
4424
+ /**
4425
+ * Use this to update Geoserver Wms Vendors (https://docs.geoserver.org/latest/en/user/services/wms/vendor.html)
4426
+ * and other arguements (https://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap)
4427
+ * in all the getMap requests.
4428
+ *
4429
+ * Example: you can use this to change the style of the WMS, add a custom sld, set a cql_filter, etc.
4430
+ *
4431
+ * @public
4432
+ * @param paramName
4433
+ * @param value
4434
+ * @param refresh
4435
+ */
4436
+ setCustomParam(paramName, value = null, refresh = true) {
4437
+ const source = this.getSource();
4438
+ source.urlParams.set(paramName, value);
4439
+ if (refresh) {
4440
+ this.refresh();
4441
+ }
4442
+ return source.urlParams;
4443
+ }
4636
4444
  }
4637
4445
 
4638
- class WmsSource extends Mixin(TileWMS__default["default"], BaseSource) {
4639
- geoserverProps_ = [
4640
- 'cql_filter',
4641
- 'filter',
4642
- 'orderBy',
4643
- 'maxFeatures',
4644
- 'startIndex',
4645
- 'featureid',
4646
- 'format_options',
4647
- 'propertyname',
4648
- 'buffer',
4649
- 'clip',
4650
- 'env'
4651
- ];
4446
+ /**
4447
+ * Layer source to retrieve WMS information from geoservers
4448
+ * https://docs.geoserver.org/stable/en/user/services/wms/reference.html
4449
+ *
4450
+ * @extends {ol/source/TieWMS~TileWMS}
4451
+ * @param options
4452
+ */
4453
+ class WmsSource extends TileWMS__default["default"] {
4652
4454
  constructor(options) {
4653
4455
  super({
4654
4456
  url: options.geoserverUrl,
@@ -4693,75 +4495,8 @@
4693
4495
  },
4694
4496
  ...options
4695
4497
  });
4696
- this.addEvents_();
4697
- }
4698
- /**
4699
- * @public
4700
- * @param value
4701
- * @param opt_silent
4702
- */
4703
- setBuffer(value, opt_silent) {
4704
- this.set(WmsSourceProperty.BUFFER, value, opt_silent);
4705
- }
4706
- /**
4707
- * @public
4708
- * @returns
4709
- */
4710
- getBuffer() {
4711
- return this.get(WmsSourceProperty.BUFFER);
4712
- }
4713
- /**
4714
- * @public
4715
- * @param value
4716
- * @param opt_silent
4717
- */
4718
- setEnv(value, opt_silent) {
4719
- this.set(WmsSourceProperty.ENV, value, opt_silent);
4720
- }
4721
- /**
4722
- * @public
4723
- * @returns
4724
- */
4725
- getEnv() {
4726
- return this.get(WmsSourceProperty.ENV);
4727
- }
4728
- /**
4729
- * @public
4730
- * @param value
4731
- * @param opt_silent
4732
- */
4733
- setClip(value, opt_silent) {
4734
- this.set(WmsSourceProperty.CLIP, value, opt_silent);
4735
- }
4736
- /**
4737
- * @public
4738
- * @returns
4739
- */
4740
- getClip() {
4741
- return this.get(WmsSourceProperty.CLIP);
4742
- }
4743
- /**
4744
- * @private
4745
- */
4746
- addEvents_() {
4747
- this.on(['propertychange'], (evt) => {
4748
- console.log(evt.key);
4749
- // If a geoserver property was modified, refresh the source
4750
- if (this.geoserverProps_.includes(evt.key)) {
4751
- this.updateParams({
4752
- [evt.key]: evt.target.get(evt.key)
4753
- });
4754
- this.refresh();
4755
- }
4756
- });
4757
4498
  }
4758
- }
4759
- var WmsSourceProperty;
4760
- (function (WmsSourceProperty) {
4761
- WmsSourceProperty["BUFFER"] = "buffer";
4762
- WmsSourceProperty["ENV"] = "env";
4763
- WmsSourceProperty["CLIP"] = "clip";
4764
- })(WmsSourceProperty || (WmsSourceProperty = {}));
4499
+ }
4765
4500
 
4766
4501
  /**
4767
4502
  * Layer to retrieve WMS information from geoservers
@@ -4821,7 +4556,7 @@
4821
4556
  * @returns
4822
4557
  * @private
4823
4558
  */
4824
- async getFeaturesByClickEvent(evt) {
4559
+ async _getFeaturesByClickEvent(evt) {
4825
4560
  const coordinate = evt.coordinate;
4826
4561
  const view = getMap().getView();
4827
4562
  // Si la vista es lejana, disminumos el buffer
@@ -4869,6 +4604,28 @@
4869
4604
  params.t = new Date().getMilliseconds();
4870
4605
  source.updateParams(params);
4871
4606
  }
4607
+ /**
4608
+ * Use this to update Geoserver Wfs Vendors (https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html)
4609
+ * and other arguements (https://docs.geoserver.org/stable/en/user/services/wfs/reference.html)
4610
+ * in all the getFeature requests.
4611
+ *
4612
+ * Example: you can use this to set a cql_filter, limit the numbers of features, etc.
4613
+ *
4614
+ * @public
4615
+ * @param paramName
4616
+ * @param value
4617
+ * @param refresh
4618
+ */
4619
+ setCustomParam(paramName, value = null, refresh = true) {
4620
+ const source = this.getSource();
4621
+ source.updateParams({
4622
+ [paramName]: value
4623
+ });
4624
+ if (refresh) {
4625
+ this.refresh();
4626
+ }
4627
+ return source.getParams();
4628
+ }
4872
4629
  }
4873
4630
 
4874
4631
  function createElement(tagName, attrs = {}, ...children) {
@@ -6450,7 +6207,7 @@
6450
6207
  layer instanceof WfsLayer) {
6451
6208
  return;
6452
6209
  }
6453
- const features = await layer.getFeaturesByClickEvent(evt);
6210
+ const features = await layer._getFeaturesByClickEvent(evt);
6454
6211
  if (!features.length) {
6455
6212
  return;
6456
6213
  }