Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a option to send bbox as GET param of getfeature requests #4570

Merged
merged 1 commit into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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