ol-wfst 4.0.5 → 4.0.6

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 (49) hide show
  1. package/README.md +974 -974
  2. package/dist/@types.d.ts +6 -0
  3. package/dist/@types.d.ts.map +1 -1
  4. package/dist/Geoserver.d.ts +13 -5
  5. package/dist/Geoserver.d.ts.map +1 -1
  6. package/dist/WfsLayer.d.ts +5 -5
  7. package/dist/WfsLayer.d.ts.map +1 -1
  8. package/dist/WmsLayer.d.ts +6 -5
  9. package/dist/WmsLayer.d.ts.map +1 -1
  10. package/dist/css/ol-wfst.bootstrap5.css +40 -11
  11. package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
  12. package/dist/modules/EditControlChanges.d.ts +1 -1
  13. package/dist/modules/EditControlChanges.d.ts.map +1 -1
  14. package/dist/modules/base/BaseLayer.d.ts +1 -1
  15. package/dist/modules/base/BaseLayer.d.ts.map +1 -1
  16. package/dist/modules/errors.d.ts +2 -1
  17. package/dist/modules/errors.d.ts.map +1 -1
  18. package/dist/ol-wfst.d.ts +11 -5
  19. package/dist/ol-wfst.d.ts.map +1 -1
  20. package/dist/ol-wfst.js +3317 -4099
  21. package/dist/ol-wfst.js.map +1 -1
  22. package/dist/ol-wfst.min.js +1 -1
  23. package/dist/ol-wfst.min.js.map +1 -1
  24. package/dist/tsconfig.tsbuildinfo +1 -0
  25. package/lib/@types.d.ts +6 -0
  26. package/lib/@types.d.ts.map +1 -1
  27. package/lib/Geoserver.d.ts +13 -5
  28. package/lib/Geoserver.d.ts.map +1 -1
  29. package/lib/WfsLayer.d.ts +5 -5
  30. package/lib/WfsLayer.d.ts.map +1 -1
  31. package/lib/WmsLayer.d.ts +6 -5
  32. package/lib/WmsLayer.d.ts.map +1 -1
  33. package/lib/modules/EditControlChanges.d.ts +1 -1
  34. package/lib/modules/EditControlChanges.d.ts.map +1 -1
  35. package/lib/modules/base/BaseLayer.d.ts +1 -1
  36. package/lib/modules/base/BaseLayer.d.ts.map +1 -1
  37. package/lib/modules/errors.d.ts +2 -1
  38. package/lib/modules/errors.d.ts.map +1 -1
  39. package/lib/ol-wfst.d.ts +11 -5
  40. package/lib/ol-wfst.d.ts.map +1 -1
  41. package/lib/ol-wfst.js +96 -66
  42. package/lib/ol-wfst.js.map +1 -1
  43. package/lib/style/css/ol-wfst.bootstrap5.css +40 -11
  44. package/lib/style/scss/-ol-wfst.bootstrap5.scss +10 -10
  45. package/lib/style/scss/_variables.scss +17 -17
  46. package/lib/style/scss/ol-wfst.scss +230 -230
  47. package/lib/tsconfig.tsbuildinfo +1 -0
  48. package/package.json +71 -72
  49. package/CHANGELOG.md +0 -103
package/README.md CHANGED
@@ -1,974 +1,974 @@
1
- # OpenLayers WFST
2
-
3
- <p align="center">
4
- <a href="https://www.npmjs.com/package/ol-wfst">
5
- <img src="https://img.shields.io/npm/v/ol-wfst.svg" alt="npm version">
6
- </a>
7
- <a href="https://img.shields.io/npm/dm/ol-wfst">
8
- <img alt="npm" src="https://img.shields.io/npm/dm/ol-wfst">
9
- </a>
10
- <a href="https://github.com/gastonzalba/ol-wfst/blob/master/LICENSE">
11
- <img src="https://img.shields.io/npm/l/ol-wfst.svg" alt="license">
12
- </a>
13
- </p>
14
-
15
- Tiny WFST-T client to insert (drawing/uploading), modify and delete features on GeoServers using [OpenLayers](https://openlayers.org/). Layers with these types of geometries are supported: _GeometryCollection_ (in this case, you can choose the geometry type of each element to draw), _Point_, _MultiPoint_, _LineString_, _MultiLineString_, _Polygon_ and _MultiPolygon_.
16
-
17
- Tested with OpenLayers version 5, 6 and 7.
18
-
19
- <img src="screenshots/example-1.jpg" alt="Drawing" style="width:50%; float:left;">
20
- <img src="screenshots/example-2.jpg" alt="Editing fields" style="width:50%; float:left;">
21
-
22
- ## Usage
23
-
24
- See [Wfst Options](#options) for more details.
25
-
26
- ```javascript
27
- import Wfst, { Geoserver, WmsLayer, WfsLayer } from 'ol-wfst';
28
- import { Fill, Stroke, Circle, Style } from 'ol/style';
29
-
30
- // Style
31
- import 'ol-wfst/lib/scss/ol-wfst.css';
32
- import 'ol-wfst/lib/scss/ol-wfst.bootstrap5.css'; // Do not import if you already have boostrap css
33
-
34
- // Optional credentials
35
- const password = 123456;
36
- const username = 'username';
37
-
38
- const geoserver = {
39
- url: 'https://mysite.com/geoserver/myworkspace/ows',
40
- advanced: {
41
- getCapabilitiesVersion: '1.3.0',
42
- getFeatureVersion: '1.0.0',
43
- describeFeatureTypeVersion: '1.1.0',
44
- lockFeatureVersion: '1.1.0',
45
- projection: 'EPSG:3857'
46
- },
47
- // Maybe you wanna add this on a proxy, at the backend
48
- headers: { Authorization: 'Basic ' + btoa(username + ':' + password) }
49
- };
50
-
51
- const wfsLayer = new WfsLayer({
52
- name: 'myPointsLayer', // Name of the layer on the GeoServer
53
- label: 'Photos', // Optional Label to be displayed in the controller
54
- geoserver: geoserver,
55
- zIndex: 99,
56
-
57
- // WfsLayers need a custom style
58
- style: new Style({
59
- image: new Circle({
60
- radius: 7,
61
- fill: new Fill({
62
- color: '#000000'
63
- }),
64
- stroke: new Stroke({
65
- color: [255, 0, 0],
66
- width: 2
67
- })
68
- })
69
- }),
70
-
71
- // See [geoserverVendor](#geoservervendor) for more details.
72
- geoserverVendor: {
73
- cql_filter: 'id > 50',
74
- maxFeatures: 500
75
- },
76
-
77
- beforeTransactFeature: function (feature, transactionType) {
78
- if (transactionType === 'insert') {
79
- // Maybe add a custom value o perform an action before insert features
80
- feature.set('customProperty', 'customValue', true);
81
- } else if (transactionType === 'update') {
82
- // ... //
83
- } else if (transactionType === 'delete') {
84
- // .. //
85
- }
86
-
87
- return feature;
88
- }
89
- });
90
-
91
- const wmsLayer = new WmsLayer({
92
- name: 'myMultiGeometryLayer',
93
- label: 'Other elements',
94
- geoserver: geoserver,
95
- // See [geoserverVendor](#geoservervendor) for more details.
96
- geoserverVendor: {
97
- cql_filter: 'id > 50',
98
- buffer: 50,
99
- maxFeatures: 500
100
- },
101
- beforeTransactFeature: function (feature, transactionType) {
102
- if (transactionType === 'insert') {
103
- // Maybe add a custom value o perform an action before insert features
104
- feature.set('customProperty', 'customValue', true);
105
- } else if (transactionType === 'update') {
106
- // ... //
107
- } else if (transactionType === 'delete') {
108
- // .. //
109
- }
110
-
111
- return feature;
112
- }
113
- });
114
-
115
- const wfst = new Wfst({
116
- layers: [wfsLayer, wmsLayer],
117
- language: 'en',
118
- showUpload: true
119
- });
120
-
121
- map.addControl(wfst);
122
- ```
123
-
124
- ### Useful methods
125
-
126
- See \[#wfsSource]
127
-
128
- ```js
129
-
130
- wmsLayer.setCustomParam('cql_filter',(`id = 28`);
131
- wmsLayer.setCustomParam('env', `tags=true`);
132
- ```
133
-
134
- ### Adding features programatically
135
-
136
- ```js
137
- const feature = new ol.Feature({
138
- geometry: new ol.geom.MultiPoint([[`-57.1145}`, `-36.2855`]])
139
- });
140
- const inserted = await myWmsLayer.insertFeatures([feature]);
141
-
142
- if (inserted) {
143
- alert('Feature inserted');
144
- } else {
145
- alert('Feature not inserted');
146
- }
147
- ```
148
-
149
- ### Events
150
-
151
- ### wfst instance events
152
-
153
- ```js
154
- wfst.on(
155
- ['modifystart', 'modifyend', 'drawstart', 'drawend', 'load', 'visible'],
156
- function (evt) {
157
- console.log(evt);
158
- }
159
- );
160
-
161
- wfst.on(['describeFeatureType'], function (evt) {
162
- console.log(evt.layer, evt.data);
163
- });
164
- ```
165
-
166
- ### Geoserver events
167
-
168
- ```js
169
- geoserver.on(['getCapabilities'], function (evt) {
170
- console.log(evt.data);
171
- });
172
- ```
173
-
174
- ### Layers events
175
-
176
- #### WMS Layer
177
-
178
- ```js
179
- wmsLayer.on(['change:describeFeatureType'], function (evt) {
180
- console.log(evt);
181
- });
182
- ```
183
-
184
- Source [TileWMS Events](https://openlayers.org/en/latest/apidoc/module-ol_Object.ObjectEvent.html)
185
-
186
- ```js
187
- wmsLayer.getSource().on([...])
188
- ```
189
-
190
- #### WFS Layer
191
-
192
- ```js
193
- wfsLayer.on(['change:describeFeatureType'], function (evt) {
194
- console.log(evt);
195
- });
196
- ```
197
-
198
- [VectorSource Events](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.VectorSourceEvent.html)
199
-
200
- ```js
201
- wfsLayer.getSource().on([...])
202
-
203
- ```
204
-
205
- ### Some considerations
206
-
207
- - If the features/vertex appear to be slightly offset after adding them, check the _Number of Decimals_ in your Workplace, you may have to increment that to have a more accurete preview.
208
- - You can configure a _Basic Authentication_ or an _HTTP Header Proxy Authentication_ with this client, but in some cases is recommended setting that on an reverse proxy on the backend.
209
- - If you don't use a reverse proxy, remeber configure [cors](https://docs.geoserver.org/latest/en/user/production/container.html#enable-cors)
210
-
211
- ## Changelog
212
-
213
- See [CHANGELOG](./CHANGELOG.md) for details of changes in each release.
214
-
215
- ## Install
216
-
217
- ### Browser
218
-
219
- #### JS
220
-
221
- Load `ol-wfst.js` after OpenLayers. The available classes are `Wfst`, `Wfst.Geoserver`, `Wfst.WfsLayer` and `Wfst.WmsLayer`.
222
-
223
- ```HTML
224
- <script src="https://unpkg.com/ol-wfst@4.0.4"></script>
225
- ```
226
-
227
- #### CSS
228
-
229
- ```HTML
230
- <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.0.4/dist/css/ol-wfst.min.css" />
231
- <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.0.4/dist/css/ol-wfst.bootstrap5.min.css" />
232
- ```
233
-
234
- ### Parcel, Webpack, etc.
235
-
236
- NPM package: [ol-wfst](https://www.npmjs.com/package/ol-wfst).
237
-
238
- Install the package via `npm`
239
-
240
- npm install ol-wfst
241
-
242
- #### JS
243
-
244
- ```js
245
- import Wfst, { Geoserver, WmsLayer, WfsLayer } from 'ol-wfst';
246
- ```
247
-
248
- #### CSS
249
-
250
- ```js
251
- // scss
252
- import 'ol-wfst/lib/style/scss/ol-wfst.scss';
253
- import 'ol-wfst/lib/style/scss/-ol-wfst.bootstrap5.scss';
254
-
255
- // or css
256
- import 'ol-wfst/lib/style/css/ol-wfst.css';
257
- import 'ol-wfst/lib/style/css/ol-wfst.bootstrap5.css';
258
- ```
259
-
260
- #### TypeScript type definition
261
-
262
- TypeScript types are shipped with the project in the dist directory and should be automatically used in a TypeScript project. Interfaces are provided for Wfst Options.
263
-
264
- ## API
265
-
266
- <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
267
-
268
- #### Table of Contents
269
-
270
- - [BaseGeoserverVendor](#basegeoservervendor)
271
- - [key](#key)
272
- - [cql_filter](#cql_filter)
273
- - [sortBy](#sortby)
274
- - [featureid](#featureid)
275
- - [filter](#filter)
276
- - [format_options](#format_options)
277
- - [maxFeatures](#maxfeatures)
278
- - [startIndex](#startindex)
279
- - [propertyname](#propertyname)
280
- - [Wfst](#wfst)
281
- - [Parameters](#parameters)
282
- - [getLayers](#getlayers)
283
- - [getLayerByName](#getlayerbyname)
284
- - [Parameters](#parameters-1)
285
- - [activateDrawMode](#activatedrawmode)
286
- - [Parameters](#parameters-2)
287
- - [activateEditMode](#activateeditmode)
288
- - [Parameters](#parameters-3)
289
- - [Geoserver](#geoserver)
290
- - [Parameters](#parameters-4)
291
- - [getCapabilities](#getcapabilities)
292
- - [setUrl](#seturl)
293
- - [Parameters](#parameters-5)
294
- - [getUrl](#geturl)
295
- - [setHeaders](#setheaders)
296
- - [Parameters](#parameters-6)
297
- - [getHeaders](#getheaders)
298
- - [setCredentials](#setcredentials)
299
- - [Parameters](#parameters-7)
300
- - [getCredentials](#getcredentials)
301
- - [setAdvanced](#setadvanced)
302
- - [Parameters](#parameters-8)
303
- - [getAdvanced](#getadvanced)
304
- - [hasTransaction](#hastransaction)
305
- - [hasLockFeature](#haslockfeature)
306
- - [getUseLockFeature](#getuselockfeature)
307
- - [setUseLockFeature](#setuselockfeature)
308
- - [Parameters](#parameters-9)
309
- - [isLoaded](#isloaded)
310
- - [getState](#getstate)
311
- - [getAndUpdateCapabilities](#getandupdatecapabilities)
312
- - [lockFeature](#lockfeature)
313
- - [Parameters](#parameters-10)
314
- - [WfsLayer](#wfslayer)
315
- - [Parameters](#parameters-11)
316
- - [refresh](#refresh)
317
- - [setCustomParam](#setcustomparam)
318
- - [Parameters](#parameters-12)
319
- - [WmsLayer](#wmslayer)
320
- - [Parameters](#parameters-13)
321
- - [refresh](#refresh-1)
322
- - [setCustomParam](#setcustomparam-1)
323
- - [Parameters](#parameters-14)
324
- - [Options](#options)
325
- - [processUpload](#processupload)
326
- - [Parameters](#parameters-15)
327
- - [layers](#layers)
328
- - [active](#active)
329
- - [evtType](#evttype)
330
- - [showControl](#showcontrol)
331
- - [modal](#modal)
332
- - [language](#language)
333
- - [i18n](#i18n)
334
- - [showUpload](#showupload)
335
- - [uploadFormats](#uploadformats)
336
- - [LayerOptions](#layeroptions)
337
- - [beforeTransactFeature](#beforetransactfeature)
338
- - [Parameters](#parameters-16)
339
- - [name](#name)
340
- - [geoserver](#geoserver-1)
341
- - [label](#label)
342
- - [geoserverVendor](#geoservervendor)
343
- - [strategy](#strategy)
344
- - [GeoserverOptions](#geoserveroptions)
345
- - [url](#url)
346
- - [advanced](#advanced)
347
- - [headers](#headers)
348
- - [credentials](#credentials)
349
- - [useLockFeature](#uselockfeature)
350
- - [GeoServerAdvanced](#geoserveradvanced)
351
- - [WfsGeoserverVendor](#wfsgeoservervendor)
352
- - [strict](#strict)
353
- - [WmsGeoserverVendor](#wmsgeoservervendor)
354
- - [buffer](#buffer)
355
- - [env](#env)
356
- - [clip](#clip)
357
- - [styles](#styles)
358
- - [transparent](#transparent)
359
- - [bgcolor](#bgcolor)
360
- - [time](#time)
361
- - [sld](#sld)
362
- - [sld_body](#sld_body)
363
- - [IGeoserverDescribeFeatureType](#igeoserverdescribefeaturetype)
364
- - [\_parsed](#_parsed)
365
- - [I18n](#i18n-1)
366
- - [labels](#labels)
367
- - [errors](#errors)
368
-
369
- ### BaseGeoserverVendor
370
-
371
- #### key
372
-
373
- Add any other param
374
-
375
- #### cql_filter
376
-
377
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#cql-filter>
378
-
379
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
380
-
381
- #### sortBy
382
-
383
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#sortBy>
384
-
385
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
386
-
387
- #### featureid
388
-
389
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#featureid>
390
-
391
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
392
-
393
- #### filter
394
-
395
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#filter>
396
-
397
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
398
-
399
- #### format_options
400
-
401
- WMS: <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#format-options>
402
- WFS: <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#format-options>
403
-
404
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
405
-
406
- #### maxFeatures
407
-
408
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex>
409
-
410
- Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
411
-
412
- #### startIndex
413
-
414
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex>
415
-
416
- Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
417
-
418
- #### propertyname
419
-
420
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#propertyname>
421
-
422
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
423
-
424
- ### Wfst
425
-
426
- **Extends ol/control/[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)~[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)**
427
-
428
- Tiny WFST-T client to insert (drawing/uploading), modify and delete
429
- features on GeoServers using OpenLayers. Layers with these types
430
- of geometries are supported: "GeometryCollection" (in this case, you can
431
- choose the geometry type of each element to draw), "Point", "MultiPoint",
432
- "LineString", "MultiLineString", "Polygon" and "MultiPolygon".
433
-
434
- #### Parameters
435
-
436
- - `options` **[Options](#options)?** Wfst options, see [Wfst Options](#options) for more details.
437
-
438
- #### getLayers
439
-
440
- Get all the layers in the ol-wfst instance
441
-
442
- Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))>**&#x20;
443
-
444
- #### getLayerByName
445
-
446
- Get a layer
447
-
448
- ##### Parameters
449
-
450
- - `layerName` (optional, default `''`)
451
-
452
- Returns **([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))**&#x20;
453
-
454
- #### activateDrawMode
455
-
456
- Activate/deactivate the draw mode
457
-
458
- ##### Parameters
459
-
460
- - `layer` **([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer) | `false`)**&#x20;
461
-
462
- Returns **void**&#x20;
463
-
464
- #### activateEditMode
465
-
466
- Activate/desactivate the edit mode
467
-
468
- ##### Parameters
469
-
470
- - `bool` (optional, default `true`)
471
-
472
- Returns **void**&#x20;
473
-
474
- ### Geoserver
475
-
476
- **Extends ol/Object~[BaseObject](https://openlayers.org/en/latest/apidoc/module-ol_Object-BaseObject.html)**
477
-
478
- #### Parameters
479
-
480
- - `options` **[GeoserverOptions](#geoserveroptions)**&#x20;
481
-
482
- #### getCapabilities
483
-
484
- Returns **XMLDocument**&#x20;
485
-
486
- #### setUrl
487
-
488
- ##### Parameters
489
-
490
- - `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
491
- - `opt_silent` (optional, default `false`)
492
-
493
- Returns **void**&#x20;
494
-
495
- #### getUrl
496
-
497
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
498
-
499
- #### setHeaders
500
-
501
- ##### Parameters
502
-
503
- - `headers` **HeadersInit** (optional, default `{}`)
504
- - `opt_silent` (optional, default `false`)
505
-
506
- Returns **void**&#x20;
507
-
508
- #### getHeaders
509
-
510
- Returns **HeadersInit**&#x20;
511
-
512
- #### setCredentials
513
-
514
- ##### Parameters
515
-
516
- - `credentials` **RequestCredentials** (optional, default `null`)
517
- - `opt_silent` (optional, default `false`)
518
-
519
- Returns **void**&#x20;
520
-
521
- #### getCredentials
522
-
523
- Returns **RequestCredentials**&#x20;
524
-
525
- #### setAdvanced
526
-
527
- ##### Parameters
528
-
529
- - `advanced` **[GeoServerAdvanced](#geoserveradvanced)** (optional, default `{}`)
530
- - `opt_silent` (optional, default `false`)
531
-
532
- Returns **void**&#x20;
533
-
534
- #### getAdvanced
535
-
536
- Returns **[GeoServerAdvanced](#geoserveradvanced)**&#x20;
537
-
538
- #### hasTransaction
539
-
540
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
541
-
542
- #### hasLockFeature
543
-
544
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
545
-
546
- #### getUseLockFeature
547
-
548
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
549
-
550
- #### setUseLockFeature
551
-
552
- ##### Parameters
553
-
554
- - `useLockFeature` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
555
- - `opt_silent` (optional, default `false`)
556
-
557
- Returns **void**&#x20;
558
-
559
- #### isLoaded
560
-
561
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
562
-
563
- #### getState
564
-
565
- #### getAndUpdateCapabilities
566
-
567
- Get the capabilities from the GeoServer and check
568
- all the available operations.
569
-
570
- Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<XMLDocument>**&#x20;
571
-
572
- #### lockFeature
573
-
574
- Lock a feature in the geoserver. Useful before editing a geometry,
575
- to avoid changes from multiples suers
576
-
577
- ##### Parameters
578
-
579
- - `featureId` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))**&#x20;
580
- - `layerName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
581
- - `retry` (optional, default `0`)
582
-
583
- Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
584
-
585
- ### WfsLayer
586
-
587
- **Extends ol/layer/Vector~[VectorLayer](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)**
588
-
589
- Layer to retrieve WFS features from geoservers
590
- <https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>
591
-
592
- #### Parameters
593
-
594
- - `options` **[LayerOptions](#layeroptions)**&#x20;
595
-
596
- #### refresh
597
-
598
- #### setCustomParam
599
-
600
- Use this to update Geoserver Wms Vendors (<https://docs.geoserver.org/latest/en/user/services/wms/vendor.html>)
601
- and other arguements (<https://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap>)
602
- in all the getMap requests.
603
-
604
- Example: you can use this to change the style of the WMS, add a custom sld, set a cql_filter, etc.
605
-
606
- ##### Parameters
607
-
608
- - `paramName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
609
- - `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Use `undefined` or `null` to remove the param (optional, default `null`)
610
- - `refresh` (optional, default `true`)
611
-
612
- Returns **URLSearchParams**&#x20;
613
-
614
- ### WmsLayer
615
-
616
- **Extends ol/layer/Tile~[TileLayer](https://openlayers.org/en/latest/apidoc/module-ol_layer_Tile-TileLayer.html)**
617
-
618
- Layer to retrieve WMS information from geoservers
619
- <https://docs.geoserver.org/stable/en/user/services/wms/reference.html>
620
-
621
- #### Parameters
622
-
623
- - `options` **[LayerOptions](#layeroptions)**&#x20;
624
-
625
- #### refresh
626
-
627
- #### setCustomParam
628
-
629
- Use this to update Geoserver Wfs Vendors (<https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html>)
630
- and other arguements (<https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>)
631
- in all the getFeature requests.
632
-
633
- Example: you can use this to set a cql_filter, limit the numbers of features, etc.
634
-
635
- ##### Parameters
636
-
637
- - `paramName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
638
- - `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `null`)
639
- - `refresh` (optional, default `true`)
640
-
641
- Returns **URLSearchParams**&#x20;
642
-
643
- ### Options
644
-
645
- **_\[interface]_** - Wfst Options specified when creating a Wfst instance
646
-
647
- Default values:
648
-
649
- ```javascript
650
- {
651
- layers: null,
652
- evtType: 'singleclick',
653
- active: true,
654
- showControl: true,
655
- language: 'en',
656
- i18n: {...}, // according to language selection
657
- uploadFormats: '.geojson,.json,.kml',
658
- processUpload: null,
659
- }
660
- ```
661
-
662
- #### processUpload
663
-
664
- Triggered to allow implement custom functions or to parse other formats than default
665
- by filtering the extension. If this doesn't return features, the default function
666
- will be used to extract them.
667
-
668
- ##### Parameters
669
-
670
- - `file` **File**&#x20;
671
-
672
- Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Feature\<Geometry>>**&#x20;
673
-
674
- #### layers
675
-
676
- Layers to be loaded from the geoserver
677
-
678
- Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))>
679
-
680
- #### active
681
-
682
- Init active
683
-
684
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
685
-
686
- #### evtType
687
-
688
- The click event to allow selection of Features to be edited
689
-
690
- Type: (`"singleclick"` | `"dblclick"`)
691
-
692
- #### showControl
693
-
694
- Show/hide the control map
695
-
696
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
697
-
698
- #### modal
699
-
700
- Modal configuration
701
-
702
- Type: {animateClass: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, animateInClass: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, transition: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, backdropTransition: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, templates: {dialog: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element))?, headerClose: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element))?}?}
703
-
704
- #### language
705
-
706
- Language to be used
707
-
708
- Type: (`"es"` | `"en"` | `"zh"`)
709
-
710
- #### i18n
711
-
712
- Custom translations
713
-
714
- Type: [I18n](#i18n)
715
-
716
- #### showUpload
717
-
718
- Show/hide the upload button
719
-
720
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
721
-
722
- #### uploadFormats
723
-
724
- Accepted extension formats on upload
725
- Example: ".json,.geojson"
726
-
727
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
728
-
729
- ### LayerOptions
730
-
731
- **Extends Omit\<[VectorLayerOptions](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\<any>, 'source'>**
732
-
733
- **_\[interface]_** - Parameters to create the layers and connect to the GeoServer
734
-
735
- You can use all the parameters supported by OpenLayers
736
-
737
- Default values:
738
-
739
- ```javascript
740
- {
741
- name: null,
742
- geoserver: null,
743
- label: null, // `name` if not provided
744
- strategy: all,
745
- geoserverVendor: null
746
- }
747
- ```
748
-
749
- #### beforeTransactFeature
750
-
751
- Triggered before inserting new features to the Geoserver.
752
- Use this to insert custom properties, modify the feature, etc.
753
-
754
- ##### Parameters
755
-
756
- - `feature` **Feature\<Geometry>**&#x20;
757
- - `transaction` **TransactionType**&#x20;
758
-
759
- Returns **Feature\<Geometry>**&#x20;
760
-
761
- #### name
762
-
763
- Layer name in the GeoServer
764
-
765
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
766
-
767
- #### geoserver
768
-
769
- Geoserver Object
770
-
771
- Type: [Geoserver](#geoserver)
772
-
773
- #### label
774
-
775
- Label to be displayed in the widget control
776
-
777
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
778
-
779
- #### geoserverVendor
780
-
781
- Available geoserver options
782
-
783
- Type: ([WfsGeoserverVendor](#wfsgeoservervendor) | [WmsGeoserverVendor](#wmsgeoservervendor))
784
-
785
- #### strategy
786
-
787
- Strategy function for loading features.
788
- Only for WFS
789
- By default `all` strategy is used
790
-
791
- Type: LoadingStrategy
792
-
793
- ### GeoserverOptions
794
-
795
- **_\[interface]_**
796
-
797
- #### url
798
-
799
- Url for OWS services. This endpoint will recive the WFS, WFST and WMS requests
800
-
801
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
802
-
803
- #### advanced
804
-
805
- Advanced options for geoserver requests
806
-
807
- Type: [GeoServerAdvanced](#geoserveradvanced)
808
-
809
- #### headers
810
-
811
- Http headers for GeoServer requests
812
- <https://developer.mozilla.org/en-US/docs/Web/API/Request/headers>
813
-
814
- Type: HeadersInit
815
-
816
- #### credentials
817
-
818
- Credentials for fetch requests
819
- <https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials>
820
-
821
- Default is 'same-origin'
822
-
823
- Type: RequestCredentials
824
-
825
- #### useLockFeature
826
-
827
- Use LockFeatue request on GeoServer when selecting features. Prevents a feature from being edited
828
- through a persistent feature lock. This is not always supportedd by the GeoServer.
829
- See <https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>
830
-
831
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
832
-
833
- ### GeoServerAdvanced
834
-
835
- **_\[interface]_**
836
-
837
- - Default values:
838
-
839
- ```javascript
840
- {
841
- getCapabilitiesVersion: '1.3.0',
842
- getFeatureVersion: '1.0.0',
843
- describeFeatureTypeVersion: '1.1.0',
844
- lockFeatureVersion: '1.1.0',
845
- wfsTransactionVersion: '1.1.0',
846
- projection: 'EPSG:3857',
847
- lockFeatureParams: {
848
- expiry: 5,
849
- lockId: 'Geoserver',
850
- releaseAction: 'SOME'
851
- }
852
- }
853
- ```
854
-
855
- ### WfsGeoserverVendor
856
-
857
- **Extends BaseGeoserverVendor**
858
-
859
- **_\[interface]_** - WFS geoserver options
860
- <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html>
861
-
862
- #### strict
863
-
864
- <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#xml-request-validation>
865
-
866
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
867
-
868
- ### WmsGeoserverVendor
869
-
870
- **Extends BaseGeoserverVendor**
871
-
872
- **_\[interface]_** - WMS geoserver options
873
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html>
874
-
875
- #### buffer
876
-
877
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#buffer>
878
-
879
- Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
880
-
881
- #### env
882
-
883
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#env>
884
-
885
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
886
-
887
- #### clip
888
-
889
- <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#clip>
890
-
891
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
892
-
893
- #### styles
894
-
895
- Styles in which layers are to be rendered.
896
- Value is a comma-separated list of style names, or empty if default styling is required.
897
- Style names may be empty in the list, to use default layer styling.
898
-
899
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
900
-
901
- #### transparent
902
-
903
- Whether the map background should be transparent. Values are true or false. Default is false
904
-
905
- Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
906
-
907
- #### bgcolor
908
-
909
- Background color for the map image. Value is in the form RRGGBB. Default is FFFFFF (white).
910
-
911
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
912
-
913
- #### time
914
-
915
- Time value or range for map data.
916
- See [Time Support in GeoServer WMS](https://docs.geoserver.org/stable/en/user/services/wms/time.html#wms-time) for more information.
917
-
918
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
919
-
920
- #### sld
921
-
922
- A URL referencing a [StyledLayerDescriptor](https://docs.geoserver.org/stable/en/user/styling/index.html#styling)
923
- XML file which controls or enhances map layers and styling
924
-
925
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
926
-
927
- #### sld_body
928
-
929
- A URL-encoded StyledLayerDescriptor XML document which controls or enhances map layers and styling
930
-
931
- Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
932
-
933
- ### IGeoserverDescribeFeatureType
934
-
935
- **_\[interface]_** - Geoserver original response on DescribeFeature request
936
-
937
- #### \_parsed
938
-
939
- DescribeFeature request parsed
940
-
941
- Type: {namespace: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), properties: any, geomType: GeometryType, geomField: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}
942
-
943
- ### I18n
944
-
945
- **_\[interface]_** - Custom Language specified when creating a WFST instance
946
-
947
- #### labels
948
-
949
- Labels section
950
-
951
- Type: {select: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, addElement: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editElement: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, save: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, delete: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, cancel: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, apply: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, upload: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editMode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, confirmDelete: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, geomTypeNotSupported: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editFields: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editGeom: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, selectDrawType: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, uploadToLayer: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, uploadFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, validFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, invalidFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, loading: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, toggleVisibility: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, close: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}
952
-
953
- #### errors
954
-
955
- Errors section
956
-
957
- Type: {capabilities: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, wfst: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layer: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layerNotFound: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layerNotVisible: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, noValidGeometry: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, geoserver: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, badFormat: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, badFile: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, lockFeature: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, transaction: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, getFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}
958
-
959
- ## TODO
960
-
961
- - \~~Add support to diferent layer styles~~
962
- - \~~Improve widget controller: visibility toggle~~
963
- - \~~Add events~~
964
- - Add `Don't show again` option in the error modal
965
- - Allow selection of multiples features and bulk edit
966
- - Add customizables styles
967
- - Improve scss (add variables)
968
- - Add cookies to persist widget controller state
969
- - Geometry type _LinearRing_ support
970
- - Tests!
971
- - Improve comments and documentation
972
- - Improve interface
973
- - Change svg imports to preserve svg structure
974
- - Improve style on editing and drawing features
1
+ # OpenLayers WFST
2
+
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/ol-wfst">
5
+ <img src="https://img.shields.io/npm/v/ol-wfst.svg" alt="npm version">
6
+ </a>
7
+ <a href="https://img.shields.io/npm/dm/ol-wfst">
8
+ <img alt="npm" src="https://img.shields.io/npm/dm/ol-wfst">
9
+ </a>
10
+ <a href="https://github.com/gastonzalba/ol-wfst/blob/master/LICENSE">
11
+ <img src="https://img.shields.io/npm/l/ol-wfst.svg" alt="license">
12
+ </a>
13
+ </p>
14
+
15
+ Tiny WFST-T client to insert (drawing/uploading), modify and delete features on GeoServers using [OpenLayers](https://openlayers.org/). Layers with these types of geometries are supported: _GeometryCollection_ (in this case, you can choose the geometry type of each element to draw), _Point_, _MultiPoint_, _LineString_, _MultiLineString_, _Polygon_ and _MultiPolygon_.
16
+
17
+ Tested with OpenLayers version 5, 6 and 7.
18
+
19
+ <img src="screenshots/example-1.jpg" alt="Drawing" style="width:50%; float:left;">
20
+ <img src="screenshots/example-2.jpg" alt="Editing fields" style="width:50%; float:left;">
21
+
22
+ ## Usage
23
+
24
+ See [Wfst Options](#options) for more details.
25
+
26
+ ```javascript
27
+ import Wfst, { Geoserver, WmsLayer, WfsLayer } from 'ol-wfst';
28
+ import { Fill, Stroke, Circle, Style } from 'ol/style';
29
+
30
+ // Style
31
+ import 'ol-wfst/lib/scss/ol-wfst.css';
32
+ import 'ol-wfst/lib/scss/ol-wfst.bootstrap5.css'; // Do not import if you already have boostrap css
33
+
34
+ // Optional credentials
35
+ const password = 123456;
36
+ const username = 'username';
37
+
38
+ const geoserver = {
39
+ url: 'https://mysite.com/geoserver/myworkspace/ows',
40
+ advanced: {
41
+ getCapabilitiesVersion: '1.3.0',
42
+ getFeatureVersion: '1.0.0',
43
+ describeFeatureTypeVersion: '1.1.0',
44
+ lockFeatureVersion: '1.1.0',
45
+ projection: 'EPSG:3857'
46
+ },
47
+ // Maybe you wanna add this on a proxy, at the backend
48
+ headers: { Authorization: 'Basic ' + btoa(username + ':' + password) }
49
+ };
50
+
51
+ const wfsLayer = new WfsLayer({
52
+ name: 'myPointsLayer', // Name of the layer on the GeoServer
53
+ label: 'Photos', // Optional Label to be displayed in the controller
54
+ geoserver: geoserver,
55
+ zIndex: 99,
56
+
57
+ // WfsLayers need a custom style
58
+ style: new Style({
59
+ image: new Circle({
60
+ radius: 7,
61
+ fill: new Fill({
62
+ color: '#000000'
63
+ }),
64
+ stroke: new Stroke({
65
+ color: [255, 0, 0],
66
+ width: 2
67
+ })
68
+ })
69
+ }),
70
+
71
+ // See [geoserverVendor](#geoservervendor) for more details.
72
+ geoserverVendor: {
73
+ cql_filter: 'id > 50',
74
+ maxFeatures: 500
75
+ },
76
+
77
+ beforeTransactFeature: function (feature, transactionType) {
78
+ if (transactionType === 'insert') {
79
+ // Maybe add a custom value o perform an action before insert features
80
+ feature.set('customProperty', 'customValue', true);
81
+ } else if (transactionType === 'update') {
82
+ // ... //
83
+ } else if (transactionType === 'delete') {
84
+ // .. //
85
+ }
86
+
87
+ return feature;
88
+ }
89
+ });
90
+
91
+ const wmsLayer = new WmsLayer({
92
+ name: 'myMultiGeometryLayer',
93
+ label: 'Other elements',
94
+ geoserver: geoserver,
95
+ // See [geoserverVendor](#geoservervendor) for more details.
96
+ geoserverVendor: {
97
+ cql_filter: 'id > 50',
98
+ buffer: 50,
99
+ maxFeatures: 500
100
+ },
101
+ beforeTransactFeature: function (feature, transactionType) {
102
+ if (transactionType === 'insert') {
103
+ // Maybe add a custom value o perform an action before insert features
104
+ feature.set('customProperty', 'customValue', true);
105
+ } else if (transactionType === 'update') {
106
+ // ... //
107
+ } else if (transactionType === 'delete') {
108
+ // .. //
109
+ }
110
+
111
+ return feature;
112
+ }
113
+ });
114
+
115
+ const wfst = new Wfst({
116
+ layers: [wfsLayer, wmsLayer],
117
+ language: 'en',
118
+ showUpload: true
119
+ });
120
+
121
+ map.addControl(wfst);
122
+ ```
123
+
124
+ ### Useful methods
125
+
126
+ See \[#wfsSource]
127
+
128
+ ```js
129
+
130
+ wmsLayer.setCustomParam('cql_filter',(`id = 28`);
131
+ wmsLayer.setCustomParam('env', `tags=true`);
132
+ ```
133
+
134
+ ### Adding features programatically
135
+
136
+ ```js
137
+ const feature = new ol.Feature({
138
+ geometry: new ol.geom.MultiPoint([[`-57.1145}`, `-36.2855`]])
139
+ });
140
+ const inserted = await myWmsLayer.insertFeatures([feature]);
141
+
142
+ if (inserted) {
143
+ alert('Feature inserted');
144
+ } else {
145
+ alert('Feature not inserted');
146
+ }
147
+ ```
148
+
149
+ ### Events
150
+
151
+ ### wfst instance events
152
+
153
+ ```js
154
+ wfst.on(
155
+ ['modifystart', 'modifyend', 'drawstart', 'drawend', 'load', 'visible'],
156
+ function (evt) {
157
+ console.log(evt);
158
+ }
159
+ );
160
+
161
+ wfst.on(['describeFeatureType'], function (evt) {
162
+ console.log(evt.layer, evt.data);
163
+ });
164
+ ```
165
+
166
+ ### Geoserver events
167
+
168
+ ```js
169
+ geoserver.on(['getCapabilities'], function (evt) {
170
+ console.log(evt.data);
171
+ });
172
+ ```
173
+
174
+ ### Layers events
175
+
176
+ #### WMS Layer
177
+
178
+ ```js
179
+ wmsLayer.on(['change:describeFeatureType'], function (evt) {
180
+ console.log(evt);
181
+ });
182
+ ```
183
+
184
+ Source [TileWMS Events](https://openlayers.org/en/latest/apidoc/module-ol_Object.ObjectEvent.html)
185
+
186
+ ```js
187
+ wmsLayer.getSource().on([...])
188
+ ```
189
+
190
+ #### WFS Layer
191
+
192
+ ```js
193
+ wfsLayer.on(['change:describeFeatureType'], function (evt) {
194
+ console.log(evt);
195
+ });
196
+ ```
197
+
198
+ [VectorSource Events](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.VectorSourceEvent.html)
199
+
200
+ ```js
201
+ wfsLayer.getSource().on([...])
202
+
203
+ ```
204
+
205
+ ### Some considerations
206
+
207
+ - If the features/vertex appear to be slightly offset after adding them, check the _Number of Decimals_ in your Workplace, you may have to increment that to have a more accurete preview.
208
+ - You can configure a _Basic Authentication_ or an _HTTP Header Proxy Authentication_ with this client, but in some cases is recommended setting that on an reverse proxy on the backend.
209
+ - If you don't use a reverse proxy, remeber configure [cors](https://docs.geoserver.org/latest/en/user/production/container.html#enable-cors)
210
+
211
+ ## Changelog
212
+
213
+ See [CHANGELOG](./CHANGELOG.md) for details of changes in each release.
214
+
215
+ ## Install
216
+
217
+ ### Browser
218
+
219
+ #### JS
220
+
221
+ Load `ol-wfst.js` after OpenLayers. The available classes are `Wfst`, `Wfst.Geoserver`, `Wfst.WfsLayer` and `Wfst.WmsLayer`.
222
+
223
+ ```HTML
224
+ <script src="https://unpkg.com/ol-wfst@4.0.4"></script>
225
+ ```
226
+
227
+ #### CSS
228
+
229
+ ```HTML
230
+ <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.0.4/dist/css/ol-wfst.min.css" />
231
+ <link rel="stylesheet" href="https://unpkg.com/ol-wfst@4.0.4/dist/css/ol-wfst.bootstrap5.min.css" />
232
+ ```
233
+
234
+ ### Parcel, Webpack, etc.
235
+
236
+ NPM package: [ol-wfst](https://www.npmjs.com/package/ol-wfst).
237
+
238
+ Install the package via `npm`
239
+
240
+ npm install ol-wfst
241
+
242
+ #### JS
243
+
244
+ ```js
245
+ import Wfst, { Geoserver, WmsLayer, WfsLayer } from 'ol-wfst';
246
+ ```
247
+
248
+ #### CSS
249
+
250
+ ```js
251
+ // scss
252
+ import 'ol-wfst/lib/style/scss/ol-wfst.scss';
253
+ import 'ol-wfst/lib/style/scss/-ol-wfst.bootstrap5.scss';
254
+
255
+ // or css
256
+ import 'ol-wfst/lib/style/css/ol-wfst.css';
257
+ import 'ol-wfst/lib/style/css/ol-wfst.bootstrap5.css';
258
+ ```
259
+
260
+ #### TypeScript type definition
261
+
262
+ TypeScript types are shipped with the project in the dist directory and should be automatically used in a TypeScript project. Interfaces are provided for Wfst Options.
263
+
264
+ ## API
265
+
266
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
267
+
268
+ #### Table of Contents
269
+
270
+ - [BaseGeoserverVendor](#basegeoservervendor)
271
+ - [key](#key)
272
+ - [cql_filter](#cql_filter)
273
+ - [sortBy](#sortby)
274
+ - [featureid](#featureid)
275
+ - [filter](#filter)
276
+ - [format_options](#format_options)
277
+ - [maxFeatures](#maxfeatures)
278
+ - [startIndex](#startindex)
279
+ - [propertyname](#propertyname)
280
+ - [Wfst](#wfst)
281
+ - [Parameters](#parameters)
282
+ - [getLayers](#getlayers)
283
+ - [getLayerByName](#getlayerbyname)
284
+ - [Parameters](#parameters-1)
285
+ - [activateDrawMode](#activatedrawmode)
286
+ - [Parameters](#parameters-2)
287
+ - [activateEditMode](#activateeditmode)
288
+ - [Parameters](#parameters-3)
289
+ - [Geoserver](#geoserver)
290
+ - [Parameters](#parameters-4)
291
+ - [getCapabilities](#getcapabilities)
292
+ - [setUrl](#seturl)
293
+ - [Parameters](#parameters-5)
294
+ - [getUrl](#geturl)
295
+ - [setHeaders](#setheaders)
296
+ - [Parameters](#parameters-6)
297
+ - [getHeaders](#getheaders)
298
+ - [setCredentials](#setcredentials)
299
+ - [Parameters](#parameters-7)
300
+ - [getCredentials](#getcredentials)
301
+ - [setAdvanced](#setadvanced)
302
+ - [Parameters](#parameters-8)
303
+ - [getAdvanced](#getadvanced)
304
+ - [hasTransaction](#hastransaction)
305
+ - [hasLockFeature](#haslockfeature)
306
+ - [getUseLockFeature](#getuselockfeature)
307
+ - [setUseLockFeature](#setuselockfeature)
308
+ - [Parameters](#parameters-9)
309
+ - [isLoaded](#isloaded)
310
+ - [getState](#getstate)
311
+ - [getAndUpdateCapabilities](#getandupdatecapabilities)
312
+ - [lockFeature](#lockfeature)
313
+ - [Parameters](#parameters-10)
314
+ - [WfsLayer](#wfslayer)
315
+ - [Parameters](#parameters-11)
316
+ - [refresh](#refresh)
317
+ - [setCustomParam](#setcustomparam)
318
+ - [Parameters](#parameters-12)
319
+ - [WmsLayer](#wmslayer)
320
+ - [Parameters](#parameters-13)
321
+ - [refresh](#refresh-1)
322
+ - [setCustomParam](#setcustomparam-1)
323
+ - [Parameters](#parameters-14)
324
+ - [Options](#options)
325
+ - [processUpload](#processupload)
326
+ - [Parameters](#parameters-15)
327
+ - [layers](#layers)
328
+ - [active](#active)
329
+ - [evtType](#evttype)
330
+ - [showControl](#showcontrol)
331
+ - [modal](#modal)
332
+ - [language](#language)
333
+ - [i18n](#i18n)
334
+ - [showUpload](#showupload)
335
+ - [uploadFormats](#uploadformats)
336
+ - [LayerOptions](#layeroptions)
337
+ - [beforeTransactFeature](#beforetransactfeature)
338
+ - [Parameters](#parameters-16)
339
+ - [name](#name)
340
+ - [geoserver](#geoserver-1)
341
+ - [label](#label)
342
+ - [geoserverVendor](#geoservervendor)
343
+ - [strategy](#strategy)
344
+ - [GeoserverOptions](#geoserveroptions)
345
+ - [url](#url)
346
+ - [advanced](#advanced)
347
+ - [headers](#headers)
348
+ - [credentials](#credentials)
349
+ - [useLockFeature](#uselockfeature)
350
+ - [GeoServerAdvanced](#geoserveradvanced)
351
+ - [WfsGeoserverVendor](#wfsgeoservervendor)
352
+ - [strict](#strict)
353
+ - [WmsGeoserverVendor](#wmsgeoservervendor)
354
+ - [buffer](#buffer)
355
+ - [env](#env)
356
+ - [clip](#clip)
357
+ - [styles](#styles)
358
+ - [transparent](#transparent)
359
+ - [bgcolor](#bgcolor)
360
+ - [time](#time)
361
+ - [sld](#sld)
362
+ - [sld_body](#sld_body)
363
+ - [IGeoserverDescribeFeatureType](#igeoserverdescribefeaturetype)
364
+ - [\_parsed](#_parsed)
365
+ - [I18n](#i18n-1)
366
+ - [labels](#labels)
367
+ - [errors](#errors)
368
+
369
+ ### BaseGeoserverVendor
370
+
371
+ #### key
372
+
373
+ Add any other param
374
+
375
+ #### cql_filter
376
+
377
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#cql-filter>
378
+
379
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
380
+
381
+ #### sortBy
382
+
383
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#sortBy>
384
+
385
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
386
+
387
+ #### featureid
388
+
389
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#featureid>
390
+
391
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
392
+
393
+ #### filter
394
+
395
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#filter>
396
+
397
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
398
+
399
+ #### format_options
400
+
401
+ WMS: <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#format-options>
402
+ WFS: <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#format-options>
403
+
404
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
405
+
406
+ #### maxFeatures
407
+
408
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex>
409
+
410
+ Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
411
+
412
+ #### startIndex
413
+
414
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#maxfeatures-and-startindex>
415
+
416
+ Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
417
+
418
+ #### propertyname
419
+
420
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#propertyname>
421
+
422
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
423
+
424
+ ### Wfst
425
+
426
+ **Extends ol/control/[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)~[Control](https://openlayers.org/en/latest/apidoc/module-ol_control_Control-Control.html)**
427
+
428
+ Tiny WFST-T client to insert (drawing/uploading), modify and delete
429
+ features on GeoServers using OpenLayers. Layers with these types
430
+ of geometries are supported: "GeometryCollection" (in this case, you can
431
+ choose the geometry type of each element to draw), "Point", "MultiPoint",
432
+ "LineString", "MultiLineString", "Polygon" and "MultiPolygon".
433
+
434
+ #### Parameters
435
+
436
+ - `options` **[Options](#options)?** Wfst options, see [Wfst Options](#options) for more details.
437
+
438
+ #### getLayers
439
+
440
+ Get all the layers in the ol-wfst instance
441
+
442
+ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))>**&#x20;
443
+
444
+ #### getLayerByName
445
+
446
+ Get a layer
447
+
448
+ ##### Parameters
449
+
450
+ - `layerName` (optional, default `''`)
451
+
452
+ Returns **([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))**&#x20;
453
+
454
+ #### activateDrawMode
455
+
456
+ Activate/deactivate the draw mode
457
+
458
+ ##### Parameters
459
+
460
+ - `layer` **([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer) | `false`)**&#x20;
461
+
462
+ Returns **void**&#x20;
463
+
464
+ #### activateEditMode
465
+
466
+ Activate/desactivate the edit mode
467
+
468
+ ##### Parameters
469
+
470
+ - `bool` (optional, default `true`)
471
+
472
+ Returns **void**&#x20;
473
+
474
+ ### Geoserver
475
+
476
+ **Extends ol/Object~[BaseObject](https://openlayers.org/en/latest/apidoc/module-ol_Object-BaseObject.html)**
477
+
478
+ #### Parameters
479
+
480
+ - `options` **[GeoserverOptions](#geoserveroptions)**&#x20;
481
+
482
+ #### getCapabilities
483
+
484
+ Returns **XMLDocument**&#x20;
485
+
486
+ #### setUrl
487
+
488
+ ##### Parameters
489
+
490
+ - `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
491
+ - `opt_silent` (optional, default `false`)
492
+
493
+ Returns **void**&#x20;
494
+
495
+ #### getUrl
496
+
497
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
498
+
499
+ #### setHeaders
500
+
501
+ ##### Parameters
502
+
503
+ - `headers` **HeadersInit** (optional, default `{}`)
504
+ - `opt_silent` (optional, default `false`)
505
+
506
+ Returns **void**&#x20;
507
+
508
+ #### getHeaders
509
+
510
+ Returns **HeadersInit**&#x20;
511
+
512
+ #### setCredentials
513
+
514
+ ##### Parameters
515
+
516
+ - `credentials` **RequestCredentials** (optional, default `null`)
517
+ - `opt_silent` (optional, default `false`)
518
+
519
+ Returns **void**&#x20;
520
+
521
+ #### getCredentials
522
+
523
+ Returns **RequestCredentials**&#x20;
524
+
525
+ #### setAdvanced
526
+
527
+ ##### Parameters
528
+
529
+ - `advanced` **[GeoServerAdvanced](#geoserveradvanced)** (optional, default `{}`)
530
+ - `opt_silent` (optional, default `false`)
531
+
532
+ Returns **void**&#x20;
533
+
534
+ #### getAdvanced
535
+
536
+ Returns **[GeoServerAdvanced](#geoserveradvanced)**&#x20;
537
+
538
+ #### hasTransaction
539
+
540
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
541
+
542
+ #### hasLockFeature
543
+
544
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
545
+
546
+ #### getUseLockFeature
547
+
548
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
549
+
550
+ #### setUseLockFeature
551
+
552
+ ##### Parameters
553
+
554
+ - `useLockFeature` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
555
+ - `opt_silent` (optional, default `false`)
556
+
557
+ Returns **void**&#x20;
558
+
559
+ #### isLoaded
560
+
561
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
562
+
563
+ #### getState
564
+
565
+ #### getAndUpdateCapabilities
566
+
567
+ Get the capabilities from the GeoServer and check
568
+ all the available operations.
569
+
570
+ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<XMLDocument>**&#x20;
571
+
572
+ #### lockFeature
573
+
574
+ Lock a feature in the geoserver. Useful before editing a geometry,
575
+ to avoid changes from multiples suers
576
+
577
+ ##### Parameters
578
+
579
+ - `featureId` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))**&#x20;
580
+ - `layerName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
581
+ - `retry` (optional, default `0`)
582
+
583
+ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**&#x20;
584
+
585
+ ### WfsLayer
586
+
587
+ **Extends ol/layer/Vector~[VectorLayer](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)**
588
+
589
+ Layer to retrieve WFS features from geoservers
590
+ <https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>
591
+
592
+ #### Parameters
593
+
594
+ - `options` **[LayerOptions](#layeroptions)**&#x20;
595
+
596
+ #### refresh
597
+
598
+ #### setCustomParam
599
+
600
+ Use this to update Geoserver Wms Vendors (<https://docs.geoserver.org/latest/en/user/services/wms/vendor.html>)
601
+ and other arguements (<https://docs.geoserver.org/stable/en/user/services/wms/reference.html#getmap>)
602
+ in all the getMap requests.
603
+
604
+ Example: you can use this to change the style of the WMS, add a custom sld, set a cql_filter, etc.
605
+
606
+ ##### Parameters
607
+
608
+ - `paramName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
609
+ - `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Use `undefined` or `null` to remove the param (optional, default `null`)
610
+ - `refresh` (optional, default `true`)
611
+
612
+ Returns **URLSearchParams**&#x20;
613
+
614
+ ### WmsLayer
615
+
616
+ **Extends ol/layer/Tile~[TileLayer](https://openlayers.org/en/latest/apidoc/module-ol_layer_Tile-TileLayer.html)**
617
+
618
+ Layer to retrieve WMS information from geoservers
619
+ <https://docs.geoserver.org/stable/en/user/services/wms/reference.html>
620
+
621
+ #### Parameters
622
+
623
+ - `options` **[LayerOptions](#layeroptions)**&#x20;
624
+
625
+ #### refresh
626
+
627
+ #### setCustomParam
628
+
629
+ Use this to update Geoserver Wfs Vendors (<https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html>)
630
+ and other arguements (<https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>)
631
+ in all the getFeature requests.
632
+
633
+ Example: you can use this to set a cql_filter, limit the numbers of features, etc.
634
+
635
+ ##### Parameters
636
+
637
+ - `paramName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
638
+ - `value` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `null`)
639
+ - `refresh` (optional, default `true`)
640
+
641
+ Returns **URLSearchParams**&#x20;
642
+
643
+ ### Options
644
+
645
+ **_\[interface]_** - Wfst Options specified when creating a Wfst instance
646
+
647
+ Default values:
648
+
649
+ ```javascript
650
+ {
651
+ layers: null,
652
+ evtType: 'singleclick',
653
+ active: true,
654
+ showControl: true,
655
+ language: 'en',
656
+ i18n: {...}, // according to language selection
657
+ uploadFormats: '.geojson,.json,.kml',
658
+ processUpload: null,
659
+ }
660
+ ```
661
+
662
+ #### processUpload
663
+
664
+ Triggered to allow implement custom functions or to parse other formats than default
665
+ by filtering the extension. If this doesn't return features, the default function
666
+ will be used to extract them.
667
+
668
+ ##### Parameters
669
+
670
+ - `file` **File**&#x20;
671
+
672
+ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Feature\<Geometry>>**&#x20;
673
+
674
+ #### layers
675
+
676
+ Layers to be loaded from the geoserver
677
+
678
+ Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<([WfsLayer](#wfslayer) | [WmsLayer](#wmslayer))>
679
+
680
+ #### active
681
+
682
+ Init active
683
+
684
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
685
+
686
+ #### evtType
687
+
688
+ The click event to allow selection of Features to be edited
689
+
690
+ Type: (`"singleclick"` | `"dblclick"`)
691
+
692
+ #### showControl
693
+
694
+ Show/hide the control map
695
+
696
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
697
+
698
+ #### modal
699
+
700
+ Modal configuration
701
+
702
+ Type: {animateClass: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, animateInClass: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, transition: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, backdropTransition: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, templates: {dialog: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element))?, headerClose: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [HTMLElement](https://developer.mozilla.org/docs/Web/HTML/Element))?}?}
703
+
704
+ #### language
705
+
706
+ Language to be used
707
+
708
+ Type: (`"es"` | `"en"` | `"zh"`)
709
+
710
+ #### i18n
711
+
712
+ Custom translations
713
+
714
+ Type: [I18n](#i18n)
715
+
716
+ #### showUpload
717
+
718
+ Show/hide the upload button
719
+
720
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
721
+
722
+ #### uploadFormats
723
+
724
+ Accepted extension formats on upload
725
+ Example: ".json,.geojson"
726
+
727
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
728
+
729
+ ### LayerOptions
730
+
731
+ **Extends Omit\<[VectorLayerOptions](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\<any>, 'source'>**
732
+
733
+ **_\[interface]_** - Parameters to create the layers and connect to the GeoServer
734
+
735
+ You can use all the parameters supported by OpenLayers
736
+
737
+ Default values:
738
+
739
+ ```javascript
740
+ {
741
+ name: null,
742
+ geoserver: null,
743
+ label: null, // `name` if not provided
744
+ strategy: all,
745
+ geoserverVendor: null
746
+ }
747
+ ```
748
+
749
+ #### beforeTransactFeature
750
+
751
+ Triggered before inserting new features to the Geoserver.
752
+ Use this to insert custom properties, modify the feature, etc.
753
+
754
+ ##### Parameters
755
+
756
+ - `feature` **Feature\<Geometry>**&#x20;
757
+ - `transaction` **TransactionType**&#x20;
758
+
759
+ Returns **Feature\<Geometry>**&#x20;
760
+
761
+ #### name
762
+
763
+ Layer name in the GeoServer
764
+
765
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
766
+
767
+ #### geoserver
768
+
769
+ Geoserver Object
770
+
771
+ Type: [Geoserver](#geoserver)
772
+
773
+ #### label
774
+
775
+ Label to be displayed in the widget control
776
+
777
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
778
+
779
+ #### geoserverVendor
780
+
781
+ Available geoserver options
782
+
783
+ Type: ([WfsGeoserverVendor](#wfsgeoservervendor) | [WmsGeoserverVendor](#wmsgeoservervendor))
784
+
785
+ #### strategy
786
+
787
+ Strategy function for loading features.
788
+ Only for WFS
789
+ By default `all` strategy is used
790
+
791
+ Type: LoadingStrategy
792
+
793
+ ### GeoserverOptions
794
+
795
+ **_\[interface]_**
796
+
797
+ #### url
798
+
799
+ Url for OWS services. This endpoint will recive the WFS, WFST and WMS requests
800
+
801
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
802
+
803
+ #### advanced
804
+
805
+ Advanced options for geoserver requests
806
+
807
+ Type: [GeoServerAdvanced](#geoserveradvanced)
808
+
809
+ #### headers
810
+
811
+ Http headers for GeoServer requests
812
+ <https://developer.mozilla.org/en-US/docs/Web/API/Request/headers>
813
+
814
+ Type: HeadersInit
815
+
816
+ #### credentials
817
+
818
+ Credentials for fetch requests
819
+ <https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials>
820
+
821
+ Default is 'same-origin'
822
+
823
+ Type: RequestCredentials
824
+
825
+ #### useLockFeature
826
+
827
+ Use LockFeatue request on GeoServer when selecting features. Prevents a feature from being edited
828
+ through a persistent feature lock. This is not always supportedd by the GeoServer.
829
+ See <https://docs.geoserver.org/stable/en/user/services/wfs/reference.html>
830
+
831
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
832
+
833
+ ### GeoServerAdvanced
834
+
835
+ **_\[interface]_**
836
+
837
+ - Default values:
838
+
839
+ ```javascript
840
+ {
841
+ getCapabilitiesVersion: '1.3.0',
842
+ getFeatureVersion: '1.0.0',
843
+ describeFeatureTypeVersion: '1.1.0',
844
+ lockFeatureVersion: '1.1.0',
845
+ wfsTransactionVersion: '1.1.0',
846
+ projection: 'EPSG:3857',
847
+ lockFeatureParams: {
848
+ expiry: 5,
849
+ lockId: 'Geoserver',
850
+ releaseAction: 'SOME'
851
+ }
852
+ }
853
+ ```
854
+
855
+ ### WfsGeoserverVendor
856
+
857
+ **Extends BaseGeoserverVendor**
858
+
859
+ **_\[interface]_** - WFS geoserver options
860
+ <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html>
861
+
862
+ #### strict
863
+
864
+ <https://docs.geoserver.org/latest/en/user/services/wfs/vendor.html#xml-request-validation>
865
+
866
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
867
+
868
+ ### WmsGeoserverVendor
869
+
870
+ **Extends BaseGeoserverVendor**
871
+
872
+ **_\[interface]_** - WMS geoserver options
873
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html>
874
+
875
+ #### buffer
876
+
877
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#buffer>
878
+
879
+ Type: ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))
880
+
881
+ #### env
882
+
883
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#env>
884
+
885
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
886
+
887
+ #### clip
888
+
889
+ <https://docs.geoserver.org/latest/en/user/services/wms/vendor.html#clip>
890
+
891
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
892
+
893
+ #### styles
894
+
895
+ Styles in which layers are to be rendered.
896
+ Value is a comma-separated list of style names, or empty if default styling is required.
897
+ Style names may be empty in the list, to use default layer styling.
898
+
899
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
900
+
901
+ #### transparent
902
+
903
+ Whether the map background should be transparent. Values are true or false. Default is false
904
+
905
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
906
+
907
+ #### bgcolor
908
+
909
+ Background color for the map image. Value is in the form RRGGBB. Default is FFFFFF (white).
910
+
911
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
912
+
913
+ #### time
914
+
915
+ Time value or range for map data.
916
+ See [Time Support in GeoServer WMS](https://docs.geoserver.org/stable/en/user/services/wms/time.html#wms-time) for more information.
917
+
918
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
919
+
920
+ #### sld
921
+
922
+ A URL referencing a [StyledLayerDescriptor](https://docs.geoserver.org/stable/en/user/styling/index.html#styling)
923
+ XML file which controls or enhances map layers and styling
924
+
925
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
926
+
927
+ #### sld_body
928
+
929
+ A URL-encoded StyledLayerDescriptor XML document which controls or enhances map layers and styling
930
+
931
+ Type: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
932
+
933
+ ### IGeoserverDescribeFeatureType
934
+
935
+ **_\[interface]_** - Geoserver original response on DescribeFeature request
936
+
937
+ #### \_parsed
938
+
939
+ DescribeFeature request parsed
940
+
941
+ Type: {namespace: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), properties: any, geomType: GeometryType, geomField: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}
942
+
943
+ ### I18n
944
+
945
+ **_\[interface]_** - Custom Language specified when creating a WFST instance
946
+
947
+ #### labels
948
+
949
+ Labels section
950
+
951
+ Type: {select: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, addElement: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editElement: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, save: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, delete: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, cancel: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, apply: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, upload: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editMode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, confirmDelete: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, geomTypeNotSupported: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editFields: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, editGeom: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, selectDrawType: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, uploadToLayer: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, uploadFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, validFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, invalidFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, loading: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, toggleVisibility: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, close: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}
952
+
953
+ #### errors
954
+
955
+ Errors section
956
+
957
+ Type: {capabilities: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, wfst: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layer: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layerNotFound: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, layerNotVisible: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, noValidGeometry: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, geoserver: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, badFormat: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, badFile: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, lockFeature: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, transaction: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, getFeatures: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}
958
+
959
+ ## TODO
960
+
961
+ - \~~Add support to diferent layer styles~~
962
+ - \~~Improve widget controller: visibility toggle~~
963
+ - \~~Add events~~
964
+ - Add `Don't show again` option in the error modal
965
+ - Allow selection of multiples features and bulk edit
966
+ - Add customizables styles
967
+ - Improve scss (add variables)
968
+ - Add cookies to persist widget controller state
969
+ - Geometry type _LinearRing_ support
970
+ - Tests!
971
+ - Improve comments and documentation
972
+ - Improve interface
973
+ - Change svg imports to preserve svg structure
974
+ - Improve style on editing and drawing features