Reputation: 99
I am using WMS CQL_FILTER option with ArcGIS JS API. The feature works fine, but I would like to know if there is a way to test whether an expression of CQL_FILTER will return at least one feature. Is this possible? I know a CQL_FILTER will filter depending on the expression, but does it return anything?
Thank you for your help! Julien
Upvotes: 0
Views: 512
Reputation: 5268
I don't think you can achieve that with WMS, that because the result is an image, the map.
If the provider also offers WFS, you can do a simple query to obtain the number of features with a determined filter.
Something like this could do the job,
http://your/server/wfs?request=getfeature&version=1.1&service=wfs&typename=the_namespace:the_featuretype&CQL_FILTER=the_filter&resultType=hits
Should get you something like this as a result,
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection numberOfFeatures="X" ... />
Where, obviously, what you want is numberOfFeatures
.
Upvotes: 2