Refreshing the layer with new query parameters
- Dominant language
- JavaScript
- Stars
- 63
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
Hi @alaframboise, I'm implementing clusterfeaturelayer.js into a WAB widget. I'm using the layer as the result for a widget that executes queries (with where, geometry, unit, distance params) on a FL.
The user will be updating and executing the search multiple times, but I don't see a way to modify the clusterfeaturelayer once it has been instantiated and added to the map. It appears the CFL has a refresh method, but it doesn't appear to be working. Also, I'm not sure how to set new params.
Can you think of a quick way to do this? Ideally, it'd look something like this:
```
this._clusterLayer.setWhere(whereString);
if (this._searchByLocation == true) {
this._clusterLayer.setGeometry(this._clickLocation);
this._clusterLayer.setDistance($(".dist-input").val());
this._clusterLayer.setUnits( $(".unit-input").val());
}
this._clusterLayer.refresh();
```
I've also modified your code slightly to take geometry params, as well:
```
this._where = options.where || null;
this._geom = options.geometry || null;
this._dist = options.distance || null;
this._units = options.units || null;
```
```
// Get the features by IDs
_getObjectIds: function(extent) {
// debug
// this._startGetOids = new Date().valueOf();
// console.debug('#_getObjectIds start');
if (this.url) {
var ext = extent || this._map.extent;
this._query.objectIds = null;
if (this._where) {
this._query.where = this._where;
}
if (this._geom) {
this._query.geometry = this._geom;
} else if (!this.MODE_SNAPSHOT) {
this._query.geometry = ext;
}
if (this._dist) {
this._query.distance = this._dist;
}
if (this._units) {
this._query.units = this._units;
}
if (!this._query.geometry && !this._query.where) {
this._query.where = '1=1';
}
this.queryTask.executeForIds(this._query).then(
lang.hitch(this, '_onIdsReturned'), this._onError
);
}
},
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in clusterfeaturelayer.js by reading the refresh method and the _getObjectIds path shown in the issue, then reproduce repeated queries from the WAB widget with changing where, geometry, distance, and units values. Done means the layer accepts updated query parameters and refreshes to display the corresponding results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100