Is it possible to dynamically change the content of an OGC WFS filter based on the BBOX of an incoming WMS request? I am attempting to serve the response of a WFS which require that I use an OGC filter on each request for the desired result.

A consequence of this is that the BBOX of the WFS request must be contained within the filter as well.

Filtering client side is not possible in this case because 1) the dataset is very large and 2) the filter parameters materially affect the ouptut.

I apologize that I cannot provide sources to the actual data. Ultimately, I need to somehow translate a standard WMS request into an appropriate WFS request. For example, if this is requested by the client:


The below Layer definiton, with the BBOX hard coded as part of the wfs_filter metadata the Mapfile, produces the correct result. But can I pass the WMS BBOX into the wfs_filter BBOX tag with each request?

      DEBUG 3
      NAME   "DigitalGlobe_WFS"
      EXTENT  -180 -90 180 90
      UNITS DD
      MAXSCALE 144000
      CONNECTION "https://placeholderservice.com/wfsaccess?
        "wfs_typename"          "WFS_Test"
        "wfs_version"           "1.0.0"
        "wfs_request_method"    "POST"
        "wfs_connectiontimeout" "60"
        "wfs_maxfeatures"       "50"
        "wfs_geometryname"      "geometry"
        "wfs_filter"            "<And>gml:Box><gml:coordinates>-104.25,39.00 -104.00,39.25</gml:coordinates></gml:Box></BBOX><PropertyIsEqualTo><PropertyName>source</PropertyName><Literal>NEW</Literal></PropertyIsEqualTo></And></Filter>
  • 1
    It should work automatically if you just remove your filter. – user30184 Dec 15 '16 at 17:24
  • It does work if i remove the filter but the filter is necessary for this use case. – maq Dec 15 '16 at 19:44
  • Why? Without your own filter MapServer creates dynamic BBOX filter. I understood that it is your aim. – user30184 Dec 15 '16 at 20:07
  • The issue is that it does not. If I remove the BBOX portion from the wfs_filter, the BBOX is not passed into the request to the WFS server. This results in the entire dataset being queried with the non-spatial filter (source=NEW in my example). – maq Dec 15 '16 at 20:21
  • Also, if using an OGC filter, a BBOX it must be included in the filter sent to the WFS. Simply tacking on "&BBOX=-104.25,39.0,-104.0,39.25" to the WFS request will throw an exception as a filter and BBOX are mutually exclusive. – maq Dec 15 '16 at 20:29

Your Answer

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

Browse other questions tagged or ask your own question.