]> git.argeo.org Git - gpl/argeo-suite.git/blob - js/src/geo/BboxVectorSource.js
Revert loading of XSD
[gpl/argeo-suite.git] / js / src / geo / BboxVectorSource.js
1
2 import VectorSource from 'ol/source/Vector.js';
3 import { bbox } from 'ol/loadingstrategy';
4 import { transformToEpsg4326LatLonExtent } from './OpenLayersUtils.js';
5
6 export default class BboxVectorSource extends VectorSource {
7 constructor(options) {
8 super(BboxVectorSource.processOptions(options));
9 }
10
11 static processOptions(options) {
12 options.strategy = bbox;
13 options.url = function(extent, resolution, projection) {
14 var bbox = transformToEpsg4326LatLonExtent(extent, projection);
15
16 const baseUrl = options.baseUrl;
17 // invert bbox order in order to have minLat,minLon,maxLat,maxLon as required by WFS 2.0.0
18 const url = baseUrl + '&bbox=' + bbox.join(',') + ',EPSG:4326';
19 return url;
20 }
21 return options;
22 }
23
24
25 }