0

Is there an ArcObjects equivalent to the CQL filter when working with WMS layers? I have reviewed the documentation, but can't identify any way of filtering a WMS service. Can anyone point me in the right direction?

EDIT: I have seen this, but the solution points to ArcIMS and is rather dated.

EDIT 2: This is essentially my approach, except that I wish to filter the WMS layers (i.e. by ID, or other attribute).

EDIT 3: The WMS does support CQL filtering, and many other OGC specifications.

EDIT 4: This may warrant another separate question on the SE. However, if creating a filtered WMS service connection is not possible, would it be possible to make a HTML GetMap request, with the desired parameters, and load the requested image into ArcMap?

  • CQL isn't supported by all WMS services either. You might consider using SLD instead. – nmtoken Feb 6 '17 at 19:46
2

Edit: based on the question's edit I think I better understand the problem - you're trying to integrate a third-party WMS into an application and you're doing this with the ArcObjects API. The WMS specification itself does not support filtering, this is something that's left to the vendor via vendor parameters (GeoServer's CQL is one of these). It's completely valid for a WMS-compliant service to not provide any filtering capability. If the WMS does support filtering the service provider needs to tell you how it's been implemented. Unless their implementation does use ArcGIS Server I think it's very unlikely that the ArcObjects API will support it directly, however the ArcObjects API may allow you to add arbitrary parameters to a request.

If the WMS service provider doesn't support filtering and you're really stuck you can take a different (more complicated) approach and filter via SLD, see this answer I wrote a while back

Edit 2: this might get you on the right track: http://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#IWMSMapLayer3_CustomParameters.htm

  • It's a subscription WMS service, not an ArcGIS Server WMS. I can access this via Add Data > Add WMS Server, but I do not have control over which layers in the stack are visible. – Barbarossa Feb 6 '17 at 17:57
  • Thanks @tomfumb, I suppose you hit the crux of my conundrum. I know all about my WMS service, including how to communicate with it via HTTP. However, I do NOT know how to add arbitrary parameters to my request. – Barbarossa Feb 6 '17 at 19:51
  • @Barbarossa see my edit. I don't envy your position, ArcObjects is an awful experience – tomfumb Feb 6 '17 at 20:18
  • After some investigation, it appears that your solution may work. However, I have no way of testing it as I am using the 10.3 SDK. Any other thoughts? – Barbarossa Feb 8 '17 at 22:02
  • @Barbarossa I've looked but the ArcObjects API is a train wreck. I either can't figure out where to look in the 10.3 documentation or it just isn't supported prior to 10.5. In my experience OGC support across ESRI products isn't amazing and you might just be stuck with what you've got. From a cursory search I couldn't see any support for providing an SLD reference or SLD_BODY parameter which likely rules out that option. – tomfumb Feb 8 '17 at 23:07
0

I have finally upgraded to 10.4 and have been upgrading ArcObject Addins. I revisited this question to see if @tomfumb's solution was viable, and it indeed is. With the use of the IWMSMapLayer3 interface I am able to add one or more CQL filters to my WMS service. The particular service I am interested in is DigitalGlobe, which uses a 'COVERAGE_CQL_FILTER'

IWMSServiceDescription serviceDesc = _wmsGroupLayer.WMSServiceDescription;
IWMSLayerDescription groupDesc = serviceDesc.get_LayerDescription(0);

IWMSMapLayer3 wmsMapLayer = (IWMSMapLayer3)_wmsGroupLayer;
IPropertySet custParamPropSet = new PropertySet();
custParamPropSet.SetProperty("COVERAGE_CQL_FILTER", "productType = 'Panchromatic'");
wmsMapLayer.CustomParameters = custParamPropSet;

While tomfumb pointed me in the right direction, I wanted to post my solution here for posterity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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