Solved! Go to Solution.
The layerDefinitions property can be used to filter the features of the individual layers in a map service. Take a look at the code snippet.
Do you mean selection by location?
You can define a QueryTask and in your Query definition you can set your query geometry and type of relationship, and display only the features you want in a graphic layer.
Hope this will help.
There is no direct solution. Other option can be....
Use querytask to get the objectIds of the features of layer within the geometry.
And then set the layerDefinitionExpression for the the layer by passing the returned ObjectIds. Like OBJECTID IN (1,2,3.......)
But there might be the limitations of number of objectid's to be passed to the layerdefinition expression. If records returned are more...
There is no direct solution. Other option can be....
Use querytask to get the objectIds of the features of layer within the geometry.
And then set the layerDefinitionExpression for the the layer by passing the returned ObjectIds. Like OBJECTID IN (1,2,3.......)
But there might be the limitations of number of objectid's to be passed to the layerdefinition expression. If records returned are more...