Skip to content

Commit

Permalink
Add a option to send bbox as GET param of getfeature requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ger-benjamin committed Jan 31, 2019
1 parent c6e42f4 commit 4bef259
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
18 changes: 18 additions & 0 deletions options/ngeox.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ ngeox.DimensionsActive;
* The options to use when sending GetFeature/GetFeatureInfo requests using
* the querent or map query service.
* @typedef {{
* bboxAsGETParam: (boolean|undefined),
* coordinate: (ol.Coordinate|undefined),
* dataSources: (Array.<ngeox.DataSource>|undefined),
* extent: (ol.Extent|undefined),
Expand All @@ -600,6 +601,14 @@ ngeox.DimensionsActive;
ngeox.IssueGetFeaturesOptions;


/**
* Pass the queried bbox as a parameter of the GET query on WFS requests.
* Default to false.
* @type {boolean|undefined}
*/
ngeox.IssueGetFeaturesOptions.prototype.bboxAsGETParam;


/**
* The coordinate to issue the requests with, which can end up with either
* WMS or WFS requests.
Expand Down Expand Up @@ -1054,6 +1063,7 @@ ngeox.QueryResultSource.prototype.totalFeatureCount;
/**
* The options for the query service.
* @typedef {{
* bboxAsGETParam: (boolean|undefined),
* limit: (number|undefined),
* queryCountFirst: (boolean|undefined),
* sourceIdsProperty: (string|undefined),
Expand All @@ -1066,6 +1076,14 @@ ngeox.QueryResultSource.prototype.totalFeatureCount;
ngeox.QueryOptions;


/**
* Pass the queried bbox as a parameter of the GET query on WFS requests.
* Default to false.
* @type {boolean|undefined}
*/
ngeox.QueryOptions.prototype.bboxAsGETParam;


/**
* The maximum number of records per request the query service should ask.
* Defaults to `50`. Note that sources sharing the same URL are combined
Expand Down
9 changes: 8 additions & 1 deletion src/services/mapquerent.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ ngeo.MapQuerent = class {
this.tolerancePx_ = options.tolerance !== undefined ?
options.tolerance : 3;

/**
* @type {boolean}
* @private
*/
this.bboxAsGETParam_ = options.bboxAsGETParam ? || false;

/**
* A hash of data source names classified by ids.
* @type {Object.<number, string>}
Expand Down Expand Up @@ -125,7 +131,8 @@ ngeo.MapQuerent = class {
queryableDataSources,
limit,
tolerancePx: this.tolerancePx_,
wfsCount: this.queryCountFirst_
wfsCount: this.queryCountFirst_,
bboxAsGETParam: this.bboxAsGETParam_
});
this.result_.pending = true;
this.ngeoQuerent_.issue(options).then(this.handleResult_.bind(this));
Expand Down
4 changes: 4 additions & 0 deletions src/services/querent.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ ngeo.Querent = class {
let url;
const params = {};

if (options.bboxAsGETParam && bbox) {
params['bbox'] = bbox.join(',');
}

// (3) Build query options
for (const dataSource of dataSources) {

Expand Down

0 comments on commit 4bef259

Please sign in to comment.