Tuesday, 12 September 2017

geoserver - Problem with WFS filters (BBOX, INTERSECTS)


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:


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">



GEOMETRY


316600 6838986
327696 6844298






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



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">




GEOMETRY



308082.07106781186 6833724.928932188 308082.07106781186 6833739.071067812 308067.92893218814 6833739.071067812 308067.92893218814 6833724.928932188 308082.07106781186 6833724.928932188









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:





317629.69841038 6841957.478078741
317902.64972173725 6841987.000123474



Answer



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




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...