2

Is it possible to use "and" & "or" queries on a WFS service through the URL?

Here's my current URL:

http://mywebsite.com/county_roads_wms_only/MapServer/WFSServer?request=GetFeature&service=WFS&typename=county_roads_wms_only:Roads&maxfeatures=2&filter=<ogc:Filter><ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%"><ogc:PropertyName>Road_Label</ogc:PropertyName><ogc:Literal>%mcculloch%</ogc:Literal></ogc:PropertyIsLike></ogc:Filter>'

Is there a way to form it so that it would be "%mcculloch% AND %st%" or "%mcculloch% OR %st% in the URL?

4
  • Does %20AND%20 work (between the variables)?
    – Erica
    Aug 25, 2014 at 16:38
  • It doesn't. This works:mymapservice.com/…"\"%20singleChar=""%20wildCard="%"><ogc:PropertyName>Road_Label</ogc:PropertyName><ogc:Literal>%harmony%</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike%20escape="\"%20singleChar=""%20wildCard="%"><ogc:PropertyName>Road_Label</ogc:PropertyName><ogc:Literal>%blvd%</ogc:Literal></ogc:PropertyIsLike></ogc:Or></ogc:Filter>. I found a related question here that helped solve the issue:gis.stackexchange.com/questions/18473/… Aug 25, 2014 at 16:53
  • Great! I was totally just guessing.
    – Erica
    Aug 25, 2014 at 16:57
  • 1
    OGC standards are not an enjoy to read but they are often better than guessing. In this case the answer is in Filter Encoding Standard 1.1.0 portal.opengeospatial.org/files/?artifact_id=51130.
    – user30184
    Aug 25, 2014 at 17:21

1 Answer 1

1

This works:

http://mymapservice.com/?request=GetFeature&service=WFS&typename=county_roads_wms_only:Roads&filter=<ogc:Filter><ogc:Or><ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%"><ogc:PropertyName>Road_Label</ogc:PropertyName><ogc:Literal>%harmony%</ogc:Literal></ogc:PropertyIsLike><ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%"><ogc:PropertyName>Road_Label</ogc:PropertyName><ogc:Literal>%blvd%</ogc:Literal></ogc:PropertyIsLike></ogc:Or></ogc:Filter>

The or operator is and goes directly after the tag. Then you just repeat the or whatever parameter with a different tag value for each or in your query.

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