ol-wfst 3.0.1 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/README.md +35 -8
- package/dist/assets/i18n/es.d.ts.map +1 -1
- package/dist/assets/i18n/index.d.ts +1 -0
- package/dist/assets/i18n/index.d.ts.map +1 -1
- package/dist/assets/i18n/zh.d.ts +3 -0
- package/dist/assets/i18n/zh.d.ts.map +1 -0
- package/dist/ol-wfst.d.ts +14 -4
- package/dist/ol-wfst.d.ts.map +1 -1
- package/dist/ol-wfst.js +163 -93
- package/dist/ol-wfst.js.map +1 -1
- package/dist/ol-wfst.min.js +1 -1
- package/dist/ol-wfst.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/assets/i18n/es.d.ts.map +1 -1
- package/lib/assets/i18n/index.d.ts +1 -0
- package/lib/assets/i18n/index.d.ts.map +1 -1
- package/lib/assets/i18n/zh.d.ts +3 -0
- package/lib/assets/i18n/zh.d.ts.map +1 -0
- package/lib/ol-wfst.d.ts +14 -4
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/ol-wfst.js +163 -93
- package/lib/ol-wfst.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Tested with OpenLayers version 5 and 6.
|
|
|
12
12
|
See [Wfst Options](#options) for more details.
|
|
13
13
|
|
|
14
14
|
```javascript
|
|
15
|
-
import
|
|
15
|
+
import Wfst from 'ol-wfst';
|
|
16
16
|
import { Fill, Stroke, Circle, Style } from 'ol/style';
|
|
17
17
|
|
|
18
18
|
// Style
|
|
@@ -61,6 +61,11 @@ const wfst = new Wfst({
|
|
|
61
61
|
name: 'myLineStringLayer',
|
|
62
62
|
label: 'Routes',
|
|
63
63
|
visible: false
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'myMultiPointLayer',
|
|
67
|
+
label: 'Markers',
|
|
68
|
+
visible: false
|
|
64
69
|
}
|
|
65
70
|
],
|
|
66
71
|
language: 'en',
|
|
@@ -73,6 +78,18 @@ const wfst = new Wfst({
|
|
|
73
78
|
}
|
|
74
79
|
});
|
|
75
80
|
|
|
81
|
+
// Adding custom feature without drawing
|
|
82
|
+
const feature = new ol.Feature({
|
|
83
|
+
geometry: new ol.geom.MultiPoint([[`-57.1145}`, `-36.2855`]])
|
|
84
|
+
});
|
|
85
|
+
const inserted = await wfst.insertFeaturesTo('myMultiPointLayer', [feature]);
|
|
86
|
+
|
|
87
|
+
if (inserted) {
|
|
88
|
+
alert('Feature inserted');
|
|
89
|
+
} else {
|
|
90
|
+
alert('Feature not inserted');
|
|
91
|
+
}
|
|
92
|
+
|
|
76
93
|
// Events
|
|
77
94
|
wfst.on(['getCapabilities', 'getFeaturesLoaded'], function (evt) {
|
|
78
95
|
console.log(evt.type, evt.data);
|
|
@@ -87,7 +104,6 @@ wfst.on(['modifystart', 'modifyend', 'drawstart', 'drawend'], function (evt) {
|
|
|
87
104
|
});
|
|
88
105
|
|
|
89
106
|
map.addControl(wfst);
|
|
90
|
-
|
|
91
107
|
```
|
|
92
108
|
|
|
93
109
|
### Some considerations
|
|
@@ -109,14 +125,14 @@ See [CHANGELOG](./CHANGELOG.md) for details of changes in each release.
|
|
|
109
125
|
Load `ol-wfst.js` after OpenLayers. Wfst is available as `Wfst`.
|
|
110
126
|
|
|
111
127
|
```HTML
|
|
112
|
-
<script src="https://unpkg.com/ol-wfst@3.0.
|
|
128
|
+
<script src="https://unpkg.com/ol-wfst@3.0.3"></script>
|
|
113
129
|
```
|
|
114
130
|
|
|
115
131
|
#### CSS
|
|
116
132
|
|
|
117
133
|
```HTML
|
|
118
|
-
<link rel="stylesheet" href="https://unpkg.com/ol-wfst@3.0.
|
|
119
|
-
<link rel="stylesheet" href="https://unpkg.com/ol-wfst@3.0.
|
|
134
|
+
<link rel="stylesheet" href="https://unpkg.com/ol-wfst@3.0.3/dist/css/ol-wfst.min.css" />
|
|
135
|
+
<link rel="stylesheet" href="https://unpkg.com/ol-wfst@3.0.3/dist/css/ol-wfst.bootstrap5.min.css" />
|
|
120
136
|
```
|
|
121
137
|
|
|
122
138
|
### Parcel, Webpack, etc.
|
|
@@ -167,6 +183,7 @@ TypeScript types are shipped with the project in the dist directory and should b
|
|
|
167
183
|
- [geoServerUrl](#geoserverurl)
|
|
168
184
|
- [geoServerAdvanced](#geoserveradvanced)
|
|
169
185
|
- [headers](#headers)
|
|
186
|
+
- [credentials](#credentials)
|
|
170
187
|
- [layers](#layers)
|
|
171
188
|
- [active](#active)
|
|
172
189
|
- [evtType](#evttype)
|
|
@@ -231,13 +248,14 @@ Returns **void**
|
|
|
231
248
|
|
|
232
249
|
Add features directly to the geoserver, in a custom layer
|
|
233
250
|
without checking geometry or showing modal to confirm.
|
|
251
|
+
Returns `true` if features are inserted correctly
|
|
234
252
|
|
|
235
253
|
##### Parameters
|
|
236
254
|
|
|
237
255
|
- `layerName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
|
|
238
256
|
- `features` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Feature\<Geometry>>**
|
|
239
257
|
|
|
240
|
-
Returns **
|
|
258
|
+
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>**
|
|
241
259
|
|
|
242
260
|
### Options
|
|
243
261
|
|
|
@@ -257,6 +275,7 @@ Default values:
|
|
|
257
275
|
projection: 'EPSG:3857'
|
|
258
276
|
},
|
|
259
277
|
headers: {},
|
|
278
|
+
credentials: 'same-origin',
|
|
260
279
|
layers: null,
|
|
261
280
|
evtType: 'singleclick',
|
|
262
281
|
active: true,
|
|
@@ -286,9 +305,17 @@ Type: {getCapabilitiesVersion: [string](https://developer.mozilla.org/docs/Web/J
|
|
|
286
305
|
#### headers
|
|
287
306
|
|
|
288
307
|
Url headers for GeoServer requests. You can use it to add Authorization credentials
|
|
308
|
+
<https://developer.mozilla.org/en-US/docs/Web/API/Request/headers>
|
|
289
309
|
|
|
290
310
|
Type: HeadersInit
|
|
291
311
|
|
|
312
|
+
#### credentials
|
|
313
|
+
|
|
314
|
+
Credentials for fetch requests
|
|
315
|
+
<https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials>
|
|
316
|
+
|
|
317
|
+
Type: RequestCredentials
|
|
318
|
+
|
|
292
319
|
#### layers
|
|
293
320
|
|
|
294
321
|
Layers to be loaded from the geoserver
|
|
@@ -337,7 +364,7 @@ Type: {animateClass: [string](https://developer.mozilla.org/docs/Web/JavaScript/
|
|
|
337
364
|
|
|
338
365
|
Language to be used
|
|
339
366
|
|
|
340
|
-
Type: (`"es"` | `"en"`)
|
|
367
|
+
Type: (`"es"` | `"en"` | `"zh"`)
|
|
341
368
|
|
|
342
369
|
#### i18n
|
|
343
370
|
|
|
@@ -457,7 +484,7 @@ Type: {select: [string](https://developer.mozilla.org/docs/Web/JavaScript/Refere
|
|
|
457
484
|
|
|
458
485
|
Errors section
|
|
459
486
|
|
|
460
|
-
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)?, 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)?}
|
|
487
|
+
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)?, 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)?}
|
|
461
488
|
|
|
462
489
|
## TODO
|
|
463
490
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../src/assets/i18n/es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../../src/assets/i18n/es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,eAAO,MAAM,EAAE,EAAE,IAwChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assets/i18n/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/assets/i18n/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,MAAM,CAAC;AACrB,cAAc,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../../src/assets/i18n/zh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,eAAO,MAAM,EAAE,EAAE,IAqChB,CAAC"}
|
package/dist/ol-wfst.d.ts
CHANGED
|
@@ -175,7 +175,7 @@ export default class Wfst extends Control {
|
|
|
175
175
|
* @param layerName
|
|
176
176
|
* @private
|
|
177
177
|
*/
|
|
178
|
-
_transactWFS(action: string, features: Array<Feature<Geometry>> | Feature<Geometry>, layerName: string): Promise<
|
|
178
|
+
_transactWFS(action: string, features: Array<Feature<Geometry>> | Feature<Geometry>, layerName: string): Promise<boolean>;
|
|
179
179
|
/**
|
|
180
180
|
*
|
|
181
181
|
* @param feature
|
|
@@ -302,14 +302,16 @@ export default class Wfst extends Control {
|
|
|
302
302
|
*/
|
|
303
303
|
activateEditMode(bool?: boolean): void;
|
|
304
304
|
/**
|
|
305
|
+
*
|
|
305
306
|
* Add features directly to the geoserver, in a custom layer
|
|
306
307
|
* without checking geometry or showing modal to confirm.
|
|
308
|
+
* Returns `true` if features are inserted correctly
|
|
307
309
|
*
|
|
308
310
|
* @param layerName
|
|
309
311
|
* @param features
|
|
310
|
-
* @
|
|
312
|
+
* @returns
|
|
311
313
|
*/
|
|
312
|
-
insertFeaturesTo(layerName: string, features: Array<Feature<Geometry>>):
|
|
314
|
+
insertFeaturesTo(layerName: string, features: Array<Feature<Geometry>>): Promise<boolean>;
|
|
313
315
|
/**
|
|
314
316
|
* Shows a fields form in a modal window to allow changes in the properties of the feature.
|
|
315
317
|
*
|
|
@@ -340,6 +342,7 @@ export default class Wfst extends Control {
|
|
|
340
342
|
* projection: 'EPSG:3857'
|
|
341
343
|
* },
|
|
342
344
|
* headers: {},
|
|
345
|
+
* credentials: 'same-origin',
|
|
343
346
|
* layers: null,
|
|
344
347
|
* evtType: 'singleclick',
|
|
345
348
|
* active: true,
|
|
@@ -372,8 +375,14 @@ interface Options {
|
|
|
372
375
|
};
|
|
373
376
|
/**
|
|
374
377
|
* Url headers for GeoServer requests. You can use it to add Authorization credentials
|
|
378
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Request/headers
|
|
375
379
|
*/
|
|
376
380
|
headers?: HeadersInit;
|
|
381
|
+
/**
|
|
382
|
+
* Credentials for fetch requests
|
|
383
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials
|
|
384
|
+
*/
|
|
385
|
+
credentials?: RequestCredentials;
|
|
377
386
|
/**
|
|
378
387
|
* Layers to be loaded from the geoserver
|
|
379
388
|
*/
|
|
@@ -416,7 +425,7 @@ interface Options {
|
|
|
416
425
|
/**
|
|
417
426
|
* Language to be used
|
|
418
427
|
*/
|
|
419
|
-
language?: 'es' | 'en';
|
|
428
|
+
language?: 'es' | 'en' | 'zh';
|
|
420
429
|
/**
|
|
421
430
|
* Custom translations
|
|
422
431
|
*/
|
|
@@ -534,6 +543,7 @@ interface I18n {
|
|
|
534
543
|
capabilities?: string;
|
|
535
544
|
wfst?: string;
|
|
536
545
|
layer?: string;
|
|
546
|
+
layerNotFound?: string;
|
|
537
547
|
noValidGeometry?: string;
|
|
538
548
|
geoserver?: string;
|
|
539
549
|
badFormat?: string;
|
package/dist/ol-wfst.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ol-wfst.d.ts","sourceRoot":"","sources":["../src/ol-wfst.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,QAAQ,EAQX,MAAM,SAAS,CAAC;AACjB,OAAO,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MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACL;AAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/ol-wfst.js
CHANGED
|
@@ -3488,6 +3488,7 @@
|
|
|
3488
3488
|
capabilities: 'No se pudieron obtener las Capabilidades del GeoServer',
|
|
3489
3489
|
wfst: 'El GeoServer no tiene soporte a Transacciones',
|
|
3490
3490
|
layer: 'No se pudieron obtener datos de la capa',
|
|
3491
|
+
layerNotFound: 'CApa no encontrada',
|
|
3491
3492
|
noValidGeometry: 'No se encontraron geometrías válidas para agregar a esta capa',
|
|
3492
3493
|
geoserver: 'No se pudieron obtener datos desde el GeoServer',
|
|
3493
3494
|
badFormat: 'Formato no soportado',
|
|
@@ -3526,20 +3527,61 @@
|
|
|
3526
3527
|
capabilities: 'GeoServer Capabilities could not be downloaded.',
|
|
3527
3528
|
wfst: 'The GeoServer does not support Transactions',
|
|
3528
3529
|
layer: 'Could not get data from layer',
|
|
3530
|
+
layerNotFound: 'Layer not found',
|
|
3529
3531
|
noValidGeometry: 'No valid geometries found to add to this layer',
|
|
3530
3532
|
geoserver: 'Could not get data from the GeoServer',
|
|
3531
3533
|
badFormat: 'Unsupported format',
|
|
3532
3534
|
badFile: 'Error reading items from file',
|
|
3533
|
-
lockFeature: '
|
|
3535
|
+
lockFeature: 'Could not lock items on the GeoServer. HTTP status:',
|
|
3534
3536
|
transaction: 'Error when doing Transaction with GeoServer. HTTP status:',
|
|
3535
3537
|
getFeatures: 'Error getting elements from GeoServer. HTTP status:'
|
|
3536
3538
|
}
|
|
3537
3539
|
};
|
|
3538
3540
|
|
|
3541
|
+
const zh = {
|
|
3542
|
+
labels: {
|
|
3543
|
+
select: '选择',
|
|
3544
|
+
addElement: '切换绘图类型',
|
|
3545
|
+
editElement: '编辑元素',
|
|
3546
|
+
save: '保存',
|
|
3547
|
+
delete: '删除',
|
|
3548
|
+
cancel: '取消',
|
|
3549
|
+
apply: '确认并应用改变',
|
|
3550
|
+
upload: '上传',
|
|
3551
|
+
editMode: '编辑模式',
|
|
3552
|
+
confirmDelete: '确认删除元素?',
|
|
3553
|
+
geomTypeNotSupported: '图层不支持该几何',
|
|
3554
|
+
editFields: '编辑区域',
|
|
3555
|
+
editGeom: '编辑几何',
|
|
3556
|
+
selectDrawType: '几何类型',
|
|
3557
|
+
uploadToLayer: '通过文件上传图层',
|
|
3558
|
+
uploadFeatures: '上传元素到图层',
|
|
3559
|
+
validFeatures: '合法的几何类型',
|
|
3560
|
+
invalidFeatures: '不合法',
|
|
3561
|
+
loading: '加载中...',
|
|
3562
|
+
toggleVisibility: '切换图层透明度',
|
|
3563
|
+
close: '关闭'
|
|
3564
|
+
},
|
|
3565
|
+
errors: {
|
|
3566
|
+
capabilities: '无法加载GeoServer服务所支持的能力.',
|
|
3567
|
+
wfst: 'GeoServer不支持事务',
|
|
3568
|
+
layer: '无法从图层获得数据',
|
|
3569
|
+
layerNotFound: 'Layer not found',
|
|
3570
|
+
noValidGeometry: '不支持的几何类型无法加载到图层',
|
|
3571
|
+
geoserver: '无法从GeoServer获取数据',
|
|
3572
|
+
badFormat: '不支持的格式',
|
|
3573
|
+
badFile: '读取文件数据出错',
|
|
3574
|
+
lockFeature: '无法锁定GeoServer上的元素. HTTP状态码:',
|
|
3575
|
+
transaction: 'GeoServer处理事务出错. HTTP状态码:',
|
|
3576
|
+
getFeatures: '从GeoServer获取元素出错. HTTP状态码:'
|
|
3577
|
+
}
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3539
3580
|
var i18n = /*#__PURE__*/Object.freeze({
|
|
3540
3581
|
__proto__: null,
|
|
3541
3582
|
es: es,
|
|
3542
|
-
en: en
|
|
3583
|
+
en: en,
|
|
3584
|
+
zh: zh
|
|
3543
3585
|
});
|
|
3544
3586
|
|
|
3545
3587
|
// https://docs.geoserver.org/latest/en/user/services/wfs/axis_order.html
|
|
@@ -3593,6 +3635,7 @@
|
|
|
3593
3635
|
projection: DEFAULT_GEOSERVER_SRS
|
|
3594
3636
|
},
|
|
3595
3637
|
headers: {},
|
|
3638
|
+
credentials: 'same-origin',
|
|
3596
3639
|
layers: null,
|
|
3597
3640
|
evtType: 'singleclick',
|
|
3598
3641
|
active: true,
|
|
@@ -3704,7 +3747,8 @@
|
|
|
3704
3747
|
const url_fetch = this._options.geoServerUrl + '?' + params.toString();
|
|
3705
3748
|
try {
|
|
3706
3749
|
const response = yield fetch(url_fetch, {
|
|
3707
|
-
headers: this._options.headers
|
|
3750
|
+
headers: this._options.headers,
|
|
3751
|
+
credentials: this._options.credentials
|
|
3708
3752
|
});
|
|
3709
3753
|
if (!response.ok) {
|
|
3710
3754
|
throw new Error('');
|
|
@@ -3770,7 +3814,8 @@
|
|
|
3770
3814
|
});
|
|
3771
3815
|
const url_fetch = geoServerUrl + '?' + params.toString();
|
|
3772
3816
|
const response = yield fetch(url_fetch, {
|
|
3773
|
-
headers: this._options.headers
|
|
3817
|
+
headers: this._options.headers,
|
|
3818
|
+
credentials: this._options.credentials
|
|
3774
3819
|
});
|
|
3775
3820
|
if (!response.ok) {
|
|
3776
3821
|
throw new Error('');
|
|
@@ -3859,7 +3904,8 @@
|
|
|
3859
3904
|
tileLoadFunction: (tile, src) => __awaiter(this, void 0, void 0, function* () {
|
|
3860
3905
|
try {
|
|
3861
3906
|
const response = yield fetch(src, {
|
|
3862
|
-
headers: this._options.headers
|
|
3907
|
+
headers: this._options.headers,
|
|
3908
|
+
credentials: this._options.credentials
|
|
3863
3909
|
});
|
|
3864
3910
|
if (!response.ok) {
|
|
3865
3911
|
throw new Error('');
|
|
@@ -3934,7 +3980,8 @@
|
|
|
3934
3980
|
'?' +
|
|
3935
3981
|
params.toString();
|
|
3936
3982
|
const response = yield fetch(url_fetch, {
|
|
3937
|
-
headers: this._options.headers
|
|
3983
|
+
headers: this._options.headers,
|
|
3984
|
+
credentials: this._options.credentials
|
|
3938
3985
|
});
|
|
3939
3986
|
if (!response.ok) {
|
|
3940
3987
|
throw new Error('');
|
|
@@ -4115,7 +4162,8 @@
|
|
|
4115
4162
|
});
|
|
4116
4163
|
try {
|
|
4117
4164
|
const response = yield fetch(url, {
|
|
4118
|
-
headers: this._options.headers
|
|
4165
|
+
headers: this._options.headers,
|
|
4166
|
+
credentials: this._options.credentials
|
|
4119
4167
|
});
|
|
4120
4168
|
if (!response.ok) {
|
|
4121
4169
|
throw new Error(this._i18n.errors.getFeatures +
|
|
@@ -4483,7 +4531,8 @@
|
|
|
4483
4531
|
const url_fetch = this._options.geoServerUrl + '?' + params.toString();
|
|
4484
4532
|
try {
|
|
4485
4533
|
const response = yield fetch(url_fetch, {
|
|
4486
|
-
headers: this._options.headers
|
|
4534
|
+
headers: this._options.headers,
|
|
4535
|
+
credentials: this._options.credentials
|
|
4487
4536
|
});
|
|
4488
4537
|
if (!response.ok) {
|
|
4489
4538
|
throw new Error(this._i18n.errors.lockFeature);
|
|
@@ -4612,7 +4661,8 @@
|
|
|
4612
4661
|
}
|
|
4613
4662
|
}
|
|
4614
4663
|
if (!clonedFeatures.length) {
|
|
4615
|
-
|
|
4664
|
+
this._showError(this._i18n.errors.noValidGeometry);
|
|
4665
|
+
return false;
|
|
4616
4666
|
}
|
|
4617
4667
|
switch (action) {
|
|
4618
4668
|
case 'insert':
|
|
@@ -4636,95 +4686,111 @@
|
|
|
4636
4686
|
}
|
|
4637
4687
|
this._countRequests++;
|
|
4638
4688
|
const numberRequest = this._countRequests;
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4689
|
+
return new Promise((resolve, reject) => {
|
|
4690
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
4691
|
+
try {
|
|
4692
|
+
// Prevent fire multiples times
|
|
4693
|
+
if (numberRequest !== this._countRequests) {
|
|
4694
|
+
return;
|
|
4695
|
+
}
|
|
4696
|
+
let srs = this._view.getProjection().getCode();
|
|
4697
|
+
// Force latitude/longitude order on transactions
|
|
4698
|
+
// EPSG:4326 is longitude/latitude (assumption) and is not managed correctly by GML3
|
|
4699
|
+
srs =
|
|
4700
|
+
srs === 'EPSG:4326'
|
|
4701
|
+
? 'urn:x-ogc:def:crs:EPSG:4326'
|
|
4702
|
+
: srs;
|
|
4703
|
+
const geoLayer = this._geoServerData[layerName];
|
|
4704
|
+
if (!geoLayer) {
|
|
4705
|
+
throw new Error(this._i18n.errors.layerNotFound);
|
|
4706
|
+
}
|
|
4707
|
+
const options = {
|
|
4708
|
+
featureNS: geoLayer.namespace,
|
|
4709
|
+
featureType: layerName,
|
|
4710
|
+
srsName: srs,
|
|
4711
|
+
featurePrefix: null,
|
|
4712
|
+
nativeElements: null,
|
|
4713
|
+
version: this._options.geoServerAdvanced
|
|
4714
|
+
.wfsTransactionVersion
|
|
4715
|
+
};
|
|
4716
|
+
const transaction = this._formatWFS.writeTransaction(this._insertFeatures, this._updateFeatures, this._deleteFeatures, options);
|
|
4717
|
+
let payload = this._xs.serializeToString(transaction);
|
|
4718
|
+
const geomType = geoLayer.geomType;
|
|
4719
|
+
const geomField = geoLayer.geomField;
|
|
4720
|
+
// Ugly fix to support GeometryCollection on GML
|
|
4721
|
+
// See https://github.com/openlayers/openlayers/issues/4220
|
|
4722
|
+
if (geomType === GeometryType.GeometryCollection) {
|
|
4723
|
+
if (action === 'insert') {
|
|
4724
|
+
payload = payload.replace(/<geometry>/g, `<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${srs}"><geometryMember>`);
|
|
4725
|
+
payload = payload.replace(/<\/geometry>/g, `</geometryMember></MultiGeometry></geometry>`);
|
|
4726
|
+
}
|
|
4727
|
+
else if (action === 'update') {
|
|
4728
|
+
const gmemberIn = `<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${srs}"><geometryMember>`;
|
|
4729
|
+
const gmemberOut = `</geometryMember></MultiGeometry>`;
|
|
4730
|
+
payload = payload.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g, `$1$2${gmemberIn}$3${gmemberOut}$4$5`);
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
// Fixes geometry name, weird bug with GML:
|
|
4734
|
+
// The property for the geometry column is always named "geometry"
|
|
4665
4735
|
if (action === 'insert') {
|
|
4666
|
-
payload = payload.replace(/<
|
|
4667
|
-
payload = payload.replace(/<\/geometry>/g, `</geometryMember></MultiGeometry></geometry>`);
|
|
4736
|
+
payload = payload.replace(/<(\/?)\bgeometry\b>/g, `<$1${geomField}>`);
|
|
4668
4737
|
}
|
|
4669
|
-
else
|
|
4670
|
-
|
|
4671
|
-
const gmemberOut = `</geometryMember></MultiGeometry>`;
|
|
4672
|
-
payload = payload.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g, `$1$2${gmemberIn}$3${gmemberOut}$4$5`);
|
|
4738
|
+
else {
|
|
4739
|
+
payload = payload.replace(/<Name>geometry<\/Name>/g, `<Name>${geomField}</Name>`);
|
|
4673
4740
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
}
|
|
4680
|
-
else {
|
|
4681
|
-
payload = payload.replace(/<Name>geometry<\/Name>/g, `<Name>${geomField}</Name>`);
|
|
4682
|
-
}
|
|
4683
|
-
// Add default LockId value
|
|
4684
|
-
if (this._hasLockFeature &&
|
|
4685
|
-
this._useLockFeature &&
|
|
4686
|
-
action !== 'insert') {
|
|
4687
|
-
payload = payload.replace(`</Transaction>`, `<LockId>GeoServer</LockId></Transaction>`);
|
|
4688
|
-
}
|
|
4689
|
-
const headers = Object.assign({ 'Content-Type': 'text/xml' }, this._options.headers);
|
|
4690
|
-
const response = yield fetch(this._options.geoServerUrl, {
|
|
4691
|
-
method: 'POST',
|
|
4692
|
-
body: payload,
|
|
4693
|
-
headers: headers
|
|
4694
|
-
});
|
|
4695
|
-
if (!response.ok) {
|
|
4696
|
-
throw new Error(this._i18n.errors.transaction + ' ' + response.status);
|
|
4697
|
-
}
|
|
4698
|
-
const parseResponse = this._formatWFS.readTransactionResponse(response);
|
|
4699
|
-
if (!Object.keys(parseResponse).length) {
|
|
4700
|
-
const responseStr = yield response.text();
|
|
4701
|
-
const findError = String(responseStr).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);
|
|
4702
|
-
if (findError) {
|
|
4703
|
-
this._showError(findError[1]);
|
|
4741
|
+
// Add default LockId value
|
|
4742
|
+
if (this._hasLockFeature &&
|
|
4743
|
+
this._useLockFeature &&
|
|
4744
|
+
action !== 'insert') {
|
|
4745
|
+
payload = payload.replace(`</Transaction>`, `<LockId>GeoServer</LockId></Transaction>`);
|
|
4704
4746
|
}
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4747
|
+
const headers = Object.assign({ 'Content-Type': 'text/xml' }, this._options.headers);
|
|
4748
|
+
const response = yield fetch(this._options.geoServerUrl, {
|
|
4749
|
+
method: 'POST',
|
|
4750
|
+
body: payload,
|
|
4751
|
+
headers: headers,
|
|
4752
|
+
credentials: this._options.credentials
|
|
4753
|
+
});
|
|
4754
|
+
if (!response.ok) {
|
|
4755
|
+
throw new Error(this._i18n.errors.transaction +
|
|
4756
|
+
' ' +
|
|
4757
|
+
response.status);
|
|
4709
4758
|
}
|
|
4759
|
+
const parseResponse = this._formatWFS.readTransactionResponse(response);
|
|
4760
|
+
if (!Object.keys(parseResponse).length) {
|
|
4761
|
+
const responseStr = yield response.text();
|
|
4762
|
+
const findError = String(responseStr).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);
|
|
4763
|
+
if (findError) {
|
|
4764
|
+
throw new Error(findError[1]);
|
|
4765
|
+
}
|
|
4766
|
+
}
|
|
4767
|
+
if (action !== 'delete') {
|
|
4768
|
+
for (const feature of features) {
|
|
4769
|
+
this._editLayer.getSource().removeFeature(feature);
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
const { mode } = this._options.layers.find((layer) => layer.name === layerName);
|
|
4773
|
+
if (mode === 'wfs') {
|
|
4774
|
+
refreshWfsLayer(this._mapLayers[layerName]);
|
|
4775
|
+
}
|
|
4776
|
+
else if (mode === 'wms') {
|
|
4777
|
+
refreshWmsLayer(this._mapLayers[layerName]);
|
|
4778
|
+
}
|
|
4779
|
+
this._hideLoading();
|
|
4780
|
+
this._insertFeatures = [];
|
|
4781
|
+
this._updateFeatures = [];
|
|
4782
|
+
this._deleteFeatures = [];
|
|
4783
|
+
this._countRequests = 0;
|
|
4784
|
+
resolve(true);
|
|
4710
4785
|
}
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
refreshWmsLayer(this._mapLayers[layerName]);
|
|
4786
|
+
catch (err) {
|
|
4787
|
+
this._showError(err.message, err);
|
|
4788
|
+
this._hideLoading();
|
|
4789
|
+
this._countRequests = 0;
|
|
4790
|
+
reject();
|
|
4717
4791
|
}
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
catch (err) {
|
|
4721
|
-
this._showError(err.message, err);
|
|
4722
|
-
}
|
|
4723
|
-
this._insertFeatures = [];
|
|
4724
|
-
this._updateFeatures = [];
|
|
4725
|
-
this._deleteFeatures = [];
|
|
4726
|
-
this._countRequests = 0;
|
|
4727
|
-
}), 0);
|
|
4792
|
+
}), 0);
|
|
4793
|
+
});
|
|
4728
4794
|
});
|
|
4729
4795
|
}
|
|
4730
4796
|
/**
|
|
@@ -5454,15 +5520,19 @@
|
|
|
5454
5520
|
this.interactionWfsSelect.setActive(bool);
|
|
5455
5521
|
}
|
|
5456
5522
|
/**
|
|
5523
|
+
*
|
|
5457
5524
|
* Add features directly to the geoserver, in a custom layer
|
|
5458
5525
|
* without checking geometry or showing modal to confirm.
|
|
5526
|
+
* Returns `true` if features are inserted correctly
|
|
5459
5527
|
*
|
|
5460
5528
|
* @param layerName
|
|
5461
5529
|
* @param features
|
|
5462
|
-
* @
|
|
5530
|
+
* @returns
|
|
5463
5531
|
*/
|
|
5464
5532
|
insertFeaturesTo(layerName, features) {
|
|
5465
|
-
this
|
|
5533
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
5534
|
+
return yield this._transactWFS('insert', features, layerName);
|
|
5535
|
+
});
|
|
5466
5536
|
}
|
|
5467
5537
|
/**
|
|
5468
5538
|
* Shows a fields form in a modal window to allow changes in the properties of the feature.
|