My data is stored in PostGIS in EPSG:3035, and I query the data using WFS GetFeature as follows (in CoffeeScript)

  params = {
    service: 'WFS',
    version: '2.0.0',
    request: 'GetFeature',
    typeName: visible_layers.join(','),
    bbox: "#{e.bounds.toBBoxString()},EPSG:4326",
    srsName: "EPSG:4326"
    info_format: 'text/javascript',
    outputFormat: 'text/javascript',
    format: 'text/javascript',

    data: params,
    dataType: 'jsonp'

This builds the following URL:

And this works, apparently, until I want to select the pipeline as well.

My pipelines are all in the same table, but I use a separate layer for each (so same table with different SLD), then I see two things:

  1. For each pipeline layer I get the same pipelines (so it does not use the SLD, which determines what is visible?)
  2. I get pipelines which are not inside the BBOX, but close. Which is weird, because for my other objects this is not the case (only get objects inside the BBOX).

I would want the WFS request to also take the SLD of the layer into account, is that possible? And why does the selection of the BBOX seems more forgiving for some layers?

I am guessing I misconfigured something?

One idea I might have is that WFS is matching on BBOX? So the BBOX of my pipeline falls inside the BBOX, not the actual linestring itself? Because that could explain part of the behaviour. It is still not using the SLD :)

  • I understand these consecutive edits are intended to gradually improve my question's readability, but actually changing my code, and just minor edits regarding uppercase/lowercase? If I refer to a "bounding box" and write "bbox" (shorter) does it have to be capitalized? I did send lowercase "wfs" in my code, and that works (I want to show my working code), not get it uppercased because for some reason WFS should be uppercased every time we mention it? Does it matter for readability if i write geoserver (like a tag)/Geoserver (edit 1)/GeoServer (edit 2)?
    – nathanvda
    Nov 28, 2016 at 12:51

1 Answer 1


The WFS BBOX works in "bbox vs bbox" mode for performance reasons, if you want the more accurate geometry intersection you can use a OGC Filter or CQL filter with the intersection operator.

As for the other question, WFS won't consider SLD, only WMS does.

The SLD can have filters in rules, including spatial ones (uncommon but not impossible) but mind, they will only be used by WMS. You can try something like:

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"> <ogc:BBOX> <gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:3785"> <gml:coordinates decimal="." cs="," ts=" "> -8033496.4863128,5677373.0653376 -7988551.5136872,5718801.9346624 </gml:coordinates> </gml:Box> </ogc:BBOX> </ogc:Filter>

  • Thank you for your answer. If I can explain it is ok I guess :) Is there an alternative way to search in a bbox using the SLD?
    – nathanvda
    Nov 23, 2016 at 15:37
  • Thank you for addition. But SLD's are static imho (right?). I want the user to select a box, and I return all items inside it. Instead I am now checking to use postgis views, instead of using the table and let the SLD filter the data. I presume this might also be more efficient? As long as it is not slower, it will make the WFS-query work as expected :)
    – nathanvda
    Nov 28, 2016 at 12:48
  • 1
    If using WFS a parametric sqlt view is definitely a good solution: docs.geoserver.org/stable/en/user/data/database/… Nov 28, 2016 at 13:20
  • What is to be preferred (performance wise): 1) using a sql view or 2) a table and let SLD filter? Should I ask this in a new question?
    – nathanvda
    Nov 28, 2016 at 14:04

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.