Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible filter out some features using a definition query set from the client on a AGS layer?

I've checked out the map server layer but it only supports find and identify. Also looked at WMS, WFS and the Feature Service. Can't find a way that works. Do I need to extend the AGS to get this functionality?

Update: What I'm trying to do is opening an MXD in an ArcGIS Engine application. The MXD has an ArcGIS Server map server layer. I would like to filter out some of the features in one of the ArcGIS Server layers by using an definition query.

share|improve this question

4 Answers 4

up vote 1 down vote accepted

I don't see an easy way to do this. But might be worth trying this:

Write a custom ILayer for arcgis that uses webclient to make a REST request that queries the mapservice layer. For the constructor pass the URL to the mapserverlayer, then insert the "rest" and append a where clause. Keep in mind REST urls are case sensitive. Using the returned JSON string, build an array of some POCO equivalent to IFeatures and loop through those when ILayer.Draw is called. It won't be fast, but WMS often isn't fast either.

If the service is running under 10.0 sp1, you should also be able to fetch any bitmaps used for rendering and make you own renderer in arcengine via IPictureMarkerSymbol.

share|improve this answer
    
Uh, not an easy solution indeed. How would you manage the map service's sublayers to be able to turn individual layers on/off? –  Petr Krebs Nov 29 '10 at 21:47
    
Yes this is a possible way forward, but one drawback is that I need to configure and handle the layers myself. I don't like the fact that the FeatureService/REST layer isn't by default feature layers in ArcObjects. –  MathiasWestin Nov 30 '10 at 9:22
    
I'm testing this out a bit (and yes we are running sp1) and I can create a request that returns the correct features. But I don't get how to create a renderer for polygons or lines. I'm not sure if I'm missing something obvious but if you are referring to the legend REST api:s help.arcgis.com/en/arcgisserver/10.0/apis/rest/mslegend.html it only returns bitmaps of the swatches. –  MathiasWestin Dec 2 '10 at 15:21
    
Never mind, found DrawingInfo on the layer that gives the rendering information: help.arcgis.com/en/arcgisserver/10.0/apis/rest/fslayer.html –  MathiasWestin Dec 2 '10 at 15:47
    
Used Kirks suggestions to make a sample that work using REST API for MapExport instead of map query, help.arcgis.com/en/arcgisserver/10.0/apis/rest/export.html –  MathiasWestin Feb 16 '11 at 14:42

Take a look at ILayerDescription:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/DefinitionExpression_Property/00120000070z000000/

share|improve this answer
    
The layer doesn't support that interface. –  MathiasWestin Nov 29 '10 at 8:36

Have you tried the IMapServerSubLayer2.LayerDescription property? Map server layers do implement IMapServerSubLayer2, which allows you to access the layer description's DefinitionExpression.

share|improve this answer
    
Correct, I can access the LayerDescription on the IMapServerSubLayer, but it's read only, if I change the DefinitionExpression and call the LayerDescription property again on the layer it changes it back to an empty string. –  MathiasWestin Nov 29 '10 at 10:08
    
I've sent this as an error report to ESRI. –  MathiasWestin Nov 30 '10 at 9:16
    
    
We have also added an Idea on better ArcGIS Server support in Desktop and Engine: ideas.arcgis.com/ideaView?id=08730000000bmej –  MathiasWestin May 9 '11 at 13:38

here is what I found for flex... hope this is a start.

esri resource center

share|improve this answer
    
Thanks, but I'm trying to do this from ArcGIS Engine. –  MathiasWestin Nov 24 '10 at 18:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.