Has anyone been able to make the geometryDefinition work with the StreamLayer sample?
Has anyone been able to make the setDefinitionExpression work with the StreamLayer sample?
This has no effect:
streamLayer.setDefinitionExpression("RouteID < 50");
I set an extent and pass it in but all features still draw on the map?
var layer = new StreamLayer(featureCollection, {
socketUrl: txtWsUrl.value,
purgeOptions: { displayCount: 500 },
geometryDefinition : myextent,
The following shows that the expression is not getting set for some reason...
console.log(streamLayer.defaultDefinitionExpression);
console.log(streamLayer.getDefinitionExpression());
streamLayer.setDefinitionExpression("RouteID < 50"); // only our jurisdictions: use '' single quotes around literals
console.log("New..");
console.log(streamLayer.getDefinitionExpression());
Result (console.log)
undefined streamlayer3.html:433
undefined streamlayer3.html:434
New.. streamlayer3.html:437
undefined
Did you ever get this answered or working? I'm having the same problem and discovered that the DefinitionExpression works fine if the StreamLayer is created with an ESRI service URL, but if the StreamLayer is created using a FeatureCollection object... the setDefinitionExpression does not work and does not filter any of the data streaming thru. The definition expression does seem to be set now though.
ESRI JavaScript API doesn't support setDefinitionExpression, if you create the StreamLayer w a FeatureCollection object. The setDefinitionExpression is applied server-side and not client-side, so no way of filtering the data. For any future issues w this, you'll have to add a filter of your own in the graphic-add event. This is from ESRI...
var g = evt.graphic;
if(g.attributes.RouteID < 50){
streamLayer.remove(g);
}
});