aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-10-23 14:17:40 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-10-28 16:06:39 +0000
commit531055c3e46fb47f9cf0592d8672e98cdd5d75b5 (patch)
treeb9c581685f78de2bbe0c0fff07b3eb8b17b9253c /web
parent64687c93beffc07d0fcb10459e5a898544bf8aae (diff)
Only add filter strategy if HTTP WFS being used.
If GET-based WFS is being used, no server-side filtering takes place, so we need a client side filter to perform the same job. But if normal POST WFS is being used, the server-side filtering has already been performed, so no need to do it again (in fact, no need to return the data necessary to do such filtering either).
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/bristol/assets.js3
-rw-r--r--web/cobrands/fixmystreet/assets.js13
2 files changed, 8 insertions, 8 deletions
diff --git a/web/cobrands/bristol/assets.js b/web/cobrands/bristol/assets.js
index 0e22e8f19..0e1ac603f 100644
--- a/web/cobrands/bristol/assets.js
+++ b/web/cobrands/bristol/assets.js
@@ -19,7 +19,7 @@ var options = {
wfs_url: "https://maps.bristol.gov.uk/arcgis/services/ext/FixMyStreetSupportData/MapServer/WFSServer",
wfs_feature: "COD_ASSETS_POINT",
asset_id_field: 'COD_ASSET_ID',
- propertyNames: [ 'COD_ASSET_ID', 'COD_USRN', 'COD_ASSET_TYPE', 'SHAPE' ],
+ propertyNames: [ 'COD_ASSET_ID', 'COD_USRN', 'SHAPE' ],
filter_key: 'COD_ASSET_TYPE',
attributes: {
asset_id: 'COD_ASSET_ID',
@@ -50,7 +50,6 @@ fixmystreet.assets.add(options, {
fixmystreet.assets.add(options, {
asset_category: "Flooding",
asset_item: 'flood risk structure',
- filter_key: 'COD_ASSET_TYPE',
filter_value: 'FRST'
});
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index ad832e67f..25c1ac08e 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -596,8 +596,8 @@ function construct_layer_options(options, protocol) {
}
if (options.filter_key) {
- // Add this filter to the layer, so it can potentially be used
- // in the request (though only Bristol currently does this).
+ // Add this filter to the layer, so it can potentially be
+ // used in the request if non-HTTP WFS
if (OpenLayers.Util.isArray(options.filter_value)) {
layer_options.filter = new OpenLayers.Filter.Logical({
type: OpenLayers.Filter.Logical.OR,
@@ -621,10 +621,11 @@ function construct_layer_options(options, protocol) {
value: options.filter_value
});
}
- // Add a strategy filter to the layer, to filter the incoming results
- // after they are received. Bristol does not need this, but has to ask
- // for the filter data in its response so it doesn't then disappear.
- layer_options.strategies.push(new OpenLayers.Strategy.Filter({filter: layer_options.filter}));
+ // If using HTTP WFS, add a strategy filter to the layer,
+ // to filter the incoming results after being received.
+ if (options.http_options) {
+ layer_options.strategies.push(new OpenLayers.Strategy.Filter({filter: layer_options.filter}));
+ }
}
return layer_options;