2

Is it possible to 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 but I 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 a definition query.

4 Answers 4

1

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.

5
  • 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
    Commented Nov 29, 2010 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. Commented Nov 30, 2010 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. Commented Dec 2, 2010 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 Commented Dec 2, 2010 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 Commented Feb 16, 2011 at 14:42
1

Take a look at ILayerDescription:

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

1
  • The layer doesn't support that interface. Commented Nov 29, 2010 at 8:36
1

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

4
0

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

esri resource center

1
  • Thanks, but I'm trying to do this from ArcGIS Engine. Commented Nov 24, 2010 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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