13

I'm trying to get a feature/features from a small area using the BBOX (or INTERSECTS) filter in my WFS query. I should be expecting only a small set of features or a single feature and yet the query returns quite a handsome bunch of them.

I have GeoServer version 2.2.2 with an Oracle data store. I have disabled the 'loose bbox' selection so that shouldn't be the cause of the problem.

Here's the query with a BBOX filter:

<wfs:GetFeature
xmlns:wfs="http://www.opengis.net/wfs"
service="WFS"
version="1.1.0"
outputFormat="json"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <wfs:Query typeName="LiVi:LIIKENNE_ELEMENTTI" srsName="EPSG:3067" xmlns:LiVi="http://172.17.14.211:8080/LiVi">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
      <ogc:BBOX>
        <ogc:PropertyName>GEOMETRY</ogc:PropertyName>
        <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:3067">
          <gml:lowerCorner>316600 6838986</gml:lowerCorner>
          <gml:upperCorner>327696 6844298</gml:upperCorner>
        </gml:Envelope>
      </ogc:BBOX>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

The problem persists with the INTERSECTS filter. The size of the polygon is about 10 x 10 meters.

<wfs:GetFeature
xmlns:wfs="http://www.opengis.net/wfs"
service="WFS"
version="1.1.0"
outputFormat="json"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <wfs:Query typeName="LiVi:LIIKENNE_ELEMENTTI" srsName="EPSG:3067" xmlns:LiVi="http://172.17.14.211:8080/LiVi">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
      <ogc:Intersects>
        <ogc:PropertyName>GEOMETRY</ogc:PropertyName>
        <gml:Polygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:3067">
          <gml:exterior>
            <gml:LinearRing>
              <gml:posList>308082.07106781186 6833724.928932188 308082.07106781186 6833739.071067812 308067.92893218814 6833739.071067812 308067.92893218814 6833724.928932188 308082.07106781186 6833724.928932188</gml:posList>
            </gml:LinearRing>
          </gml:exterior>
        </gml:Polygon>
      </ogc:Intersects>
    </ogc:Filter>
  </wfs:Query>
</wfs:GetFeature>

Edit:

Here's another request (this time a GET request):

http://172.17.14.211:8080/geoserver/wfs?request=GetFeature&version=1.1.0&srsName=EPSG:3067&typeName=LiVi:LIIKENNE_ELEMENTTI&BBOX=316600,6838986,316605,6838991,EPSG:3067

Even though the BBOX area is quite small, I get 1263 features back, most of which don't even fall inside the bounds specified in the request. For instance, from one of the features in the response:

<gml:boundedBy>
  <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#3067">
    <gml:lowerCorner>317629.69841038 6841957.478078741</gml:lowerCorner>
    <gml:upperCorner>317902.64972173725 6841987.000123474</gml:upperCorner>
  </gml:Envelope>
</gml:boundedBy>

1 Answer 1

5

Problem was solved by setting the SRID value to the database and using the native SRS in Geoserver. Even though the declared (and forced) SRS code in Geoserver was the same as the native SRS, it apparently affected the spatial filters.

http://172.17.14.211:8080/geoserver/wfs?request=GetFeature&version=1.1.0&srsName=EPSG:3067&typeName=LiVi:LIIKENNE_ELEMENTTI&BBOX=316600,6838986,316605,6838991,EPSG:3067

1
  • 4
    Can you add a little more detail to this answer? What do you mean by setting the SRID to the database? You say the solution was to use the native SRS but you also say the one you were using was the native SRS so it's not clear to me what you did to solve this.
    – ca0v
    Commented Nov 29, 2016 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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