[GIS] How to use ArcGisServer from Engine

arcgis-10.0arcgis-enginearcgis-serverarcobjects

MapServerQuerySublayer (Version 10) does not seem to support setting a definition query, although according to documentation it should using ImapServerSublayer2.LayerDescription as IMapserverSublayer. Nor does it support selections, i.e. rendering objects matching a query or selection differently.

What are our options when making an Engine application which contains a MapControl consuming only arcgisserver layers? In the application we would like to change an individual layer's definition query to only show object that matches the user's interest. We would also like to render some objects as "selected" to reflect user selections.

It would also be nice to be able to get the selected objects to the client as features, which also does not seem to be supported out of the box in ArcGisServer.

Any ideas on how to accomplish this?

Edit:

I don't think that we can wait for ESRI to fix this bug, so I'm looking for an alternate solution, which may include fetching the selection as features and use a local layer. Engine seems to lack support for fetching features from a map service without having to connect to the context itself (not using the Layer's connection) or fetching them one by one using identify. Using the Feature service seems like a good idea, but Engine has no built in functionality to from a Layer fetch IFeatures from the FeatureService. I think that there would be a more graceful way than having to involve extra connections to the server, which implies more configuration in the application.

Best Answer

I've never tried this, but it seems like you could write a custom layer that uses webclient to access the mapservice via a REST API query, with returngeometry=true.

The returned json string could then be converted into a list of geometries using Json.NET. ILayer.Draw would loop through this list and draw the geometries.

If you need a legend, you could implement ILegendInfo so that it returns symbols that have been fetched via SOAP.