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

Refreshing the layer with new query parameters #46

Open
bsnider opened this issue Nov 15, 2017 · 0 comments
Open

Refreshing the layer with new query parameters #46

bsnider opened this issue Nov 15, 2017 · 0 comments

Comments

@bsnider
Copy link

bsnider commented Nov 15, 2017

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
        );
      }
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant