AnsweredAssumed Answered

Feature layer definition expression error

Question asked by CityOfVernonia on Jul 5, 2018
Latest reply on Jul 10, 2018 by rscheitlin

If a feature layer is created with a definition expression and then gets set to null it throws an error and essentially snapshots the max number features the service supports in one request and that's all the features which are displayed with no more requests on extent change. Based on the error it looks like the creating the layer with a definition expression does a snapshot thing instead of on demand.

 

If created without a definition expression, the layer can be set to null or any other expression and works fine.

 

Not sure if this is a bug or if there is another way to clear the definition expression to avoid this error. I don't see any prop like 3.x mode.

 

// EXAMPLE ONE
// create layer with definitionExpression
const layer = new FeatureLayer({
  url: 'https://service/url',
  definitionExpression: 'ACTIVE = 1'
});

layer.definitionExpression = null;
// first n number of features shown and throws error
// [esri.layers.graphics.controllers.SnapshotController] Feature limit exceeded on layer " Permits ". Not all features are shown.

layer.definitionExpression = 'ACTIVE = 1';
// works as expected

layer.definitionExpression = 'ACTIVE = 0';
// works as expected

layer.definitionExpression = null;
// same error as above

//EXAMPLE TWO
// create layer without definitionExpression
const layer = new FeatureLayer({
  url: 'https://service/url'
});

layer.definitionExpression = null;
// works as expected

layer.definitionExpression = 'ACTIVE = 1';
// works as expected

layer.definitionExpression = null;
// works as expected

layer.definitionExpression = 'ACTIVE = 0';
// works as expected

Outcomes