@provoly/dashboard 1.4.24 → 1.4.26

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.
@@ -12115,8 +12115,8 @@ class WmsService {
12115
12115
  getWmsFeatures(url) {
12116
12116
  return this.httpClient.get(url).pipe(map((json) => json));
12117
12117
  }
12118
- getWfsFeatures(wmsUrl, bbox) {
12119
- const url = wfsUrlBuilder(wmsUrl, bbox);
12118
+ getWfsFeatures(wmsUrl, bbox, geomPropName) {
12119
+ const url = wfsUrlBuilder(wmsUrl, bbox, geomPropName);
12120
12120
  return this.httpClient.get(url).pipe(map((json) => json));
12121
12121
  }
12122
12122
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: WmsService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
@@ -12129,7 +12129,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
12129
12129
  }]
12130
12130
  }], ctorParameters: () => [{ type: i1$1.HttpClient }] });
12131
12131
  const BBOX_ENHANCE_DISTANCE = 0.0001;
12132
- const wfsUrlBuilder = (wmsUrl, bbox, params) => {
12132
+ const wfsUrlBuilder = (wmsUrl, bbox, geomPropName, params) => {
12133
12133
  const enhancedBbox = [
12134
12134
  bbox[0] - BBOX_ENHANCE_DISTANCE,
12135
12135
  bbox[1] - BBOX_ENHANCE_DISTANCE,
@@ -12148,9 +12148,16 @@ const wfsUrlBuilder = (wmsUrl, bbox, params) => {
12148
12148
  };
12149
12149
  const base = wmsUrl.split('?')[0].replace('wms', 'wfs');
12150
12150
  const wmsUrlFragments = wmsUrl.split('&');
12151
- wfsFragments['typeNames'] = wmsUrlFragments.find((param) => param.includes('LAYERS'))?.split('=')[1];
12151
+ wfsFragments['typeNames'] = wmsUrlFragments.find((param) => param.toUpperCase().includes('LAYERS'))?.split('=')[1];
12152
12152
  wfsFragments['srsName'] = wmsUrlFragments.find((param) => param.toUpperCase().includes('CRS'))?.split('=')[1];
12153
- wfsFragments['cql_filter'] = wmsUrlFragments.find((param) => param.includes('CQL_FILTER'))?.split('=')[1];
12153
+ const cqlFilterFragment = wmsUrlFragments.find((param) => param.toUpperCase().includes('CQL_FILTER'));
12154
+ if (cqlFilterFragment) {
12155
+ const previousFragment = cqlFilterFragment.split('=')[1];
12156
+ // cql_filter and bbox are mutually exclusive so we need to replace bbox with a cql filter on the bbox
12157
+ wfsFragments['cql_filter'] =
12158
+ previousFragment + ` AND BBOX(${geomPropName}, ${enhancedBbox.join(',')}, 'EPSG:4326')`;
12159
+ wfsFragments['bbox'] = undefined;
12160
+ }
12154
12161
  return (base +
12155
12162
  '?' +
12156
12163
  Object.entries(wfsFragments)
@@ -12565,7 +12572,7 @@ class DashboardEffects {
12565
12572
  wmsJson.features[0].properties.count > 1) {
12566
12573
  let envBBOXCoords = [...wmsJson.features[0].properties.envBBOX.matchAll(/\d+.\d+/g)].map((m) => parseFloat(m[0]));
12567
12574
  return this.wmsService
12568
- .getWfsFeatures(action.url, envBBOXCoords)
12575
+ .getWfsFeatures(action.url, envBBOXCoords, action.geomPropName ?? wmsJson.features[0]['geometry_name'])
12569
12576
  .pipe(map((wfsJson) => ({ action, json: wfsJson })));
12570
12577
  }
12571
12578
  // if data is not a stack just add features without calling wfs service