Skip to content

Commit 16fc422

Browse files
Allow skipping the use of bbox filter.
1 parent 394cd61 commit 16fc422

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/gm3/components/map/layers/vector.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
import GML2Format from "ol/format/GML2";
3838
import GeoJSONFormat from "ol/format/GeoJSON";
3939
import EsriJsonFormat from "ol/format/EsriJSON";
40-
import { tile, bbox } from "ol/loadingstrategy";
40+
import { tile, bbox, all } from "ol/loadingstrategy";
4141
import VectorSource from "ol/source/Vector";
4242
import VectorLayer from "ol/layer/Vector";
4343
import { createXYZ } from "ol/tilegrid";
@@ -78,6 +78,12 @@ function defineSource(mapSource) {
7878
format = GeoJSONFormat;
7979
}
8080

81+
const strategyName = mapSource.config?.strategy;
82+
let strategy = bbox;
83+
if (strategyName === 'all') {
84+
strategy = all;
85+
}
86+
8187
// TODO: Ensure this gets the real map projection when
8288
// the code supports alternative projections.
8389
const mapProjection = "EPSG:3857";
@@ -94,12 +100,6 @@ function defineSource(mapSource) {
94100
);
95101
}
96102

97-
const queryExtent = transformExtent(
98-
extent,
99-
mapProjection,
100-
queryProjection
101-
);
102-
103103
const urlParams = Object.assign(
104104
{},
105105
{
@@ -108,14 +108,21 @@ function defineSource(mapSource) {
108108
service: "WFS",
109109
version: "1.1.0",
110110
request: "GetFeature",
111-
bbox: queryExtent,
112111
},
113112
mapSource.params
114113
);
115114

115+
if (strategy === bbox) {
116+
const queryExtent = transformExtent(
117+
extent,
118+
mapProjection,
119+
queryProjection
120+
);
121+
urlParams.bbox = queryExtent;
122+
}
116123
return joinUrl(mapSource.urls[0], urlParams);
117124
},
118-
strategy: bbox,
125+
strategy,
119126
};
120127
} else if (mapSource.type === "geojson") {
121128
return {

0 commit comments

Comments
 (0)