2

I have a WFS service :

https://services.ovam.be/geoserver/wfs?REQUEST=GetCapabilities&SERVICE=WFS

Where I'm trying the following:

http://services.ovam.be/geoserver/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&MAXFEATURES=9999&CRS=EPSG:31370&BBOX=123604.6385,210458.6915,123764.6385,210618.6915&OUTPUTFORMAT=json&TYPENAME=OVAM:Dossierinfo&PROPERTYNAME=(gid,dossier_id,dossier_obo,dossier_bbo,dossier_bsp,dossier_eeo,dossier_status,status_jaar,dossier_type)

This gets me the results within the BBOX. This includes Features in the whole BBOX. I only want to get the Features within a specific range.

My spatial box (the container I want results for) is a Polygon :

<?xml version="1.0" encoding="UTF-8"?>
<Polygon xmlns="http://www.opengis.net/gml" srsName="http://www.opengis.net/def/crs/EPSG/0/31370">
   <exterior>
      <LinearRing>
         <posList>123664.03100000322 210489.5150000006 123705.24599999934 210489.5150000006 123705.24599999934 210587.86800000072 123664.03100000322 210587.86800000072 123664.03100000322 210489.5150000006</posList>
      </LinearRing>
   </exterior>
</Polygon>

I have tried building a query using the CQL Filter:

CQL_FILTER=INTERSECTS(geom, POLYGON((123664.03100000322 210489.5150000006,123705.24599999934 210489.5150000006,123705.24599999934 210587.86800000072,123664.03100000322 210587.86800000072,123664.03100000322 210489.5150000006)))

Full URL :

http://services.ovam.be/geoserver/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&MAXFEATURES=9999&CRS=EPSG:31370&BBOXs=123604.6385,210458.6915,123764.6385,210618.6915&OUTPUTFORMAT=json&TYPENAME=OVAM:Dossierinfo&PROPERTYNAME=(gid,dossier_id,dossier_obo,dossier_bbo,dossier_bsp,dossier_eeo,dossier_status,status_jaar,dossier_type)&CQL_FILTER=INTERSECTS(geom, POLYGON((123664.03100000322 210489.5150000006,123705.24599999934 210489.5150000006,123705.24599999934 210587.86800000072,123664.03100000322 210587.86800000072,123664.03100000322 210489.5150000006)))

The resultset is empty - although there should be results ... If I call the GetFeature request having a BBOX of 123664.03100000322,210489.5150000006,123705.24599999934,210587.86800000072 it does retrieve results ... This BBOX is the lower / highest spatial point in the above POLYGON definition.

http://services.ovam.be/geoserver/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&MAXFEATURES=9999&BBOX=123664.03100000322,210489.5150000006,123705.24599999934,210587.86800000072&OUTPUTFORMAT=json&TYPENAME=OVAM:Dossierinfo&PROPERTYNAME=(gid,dossier_id,dossier_obo,dossier_bbo,dossier_bsp,dossier_eeo,dossier_status,status_jaar,dossier_type)&CRS=EPSG:31370

Any help in what I'm doing wrong?

  • are you sure your geometry is called geom? and is your polygon valid? – Ian Turton Nov 8 '17 at 15:55
  • Is there a way to see this? I'm u user not a administrator of the service. :) – daan.desmedt Nov 8 '17 at 16:33
  • you need to make a describeFeature request to see the schema of the feature – Ian Turton Nov 8 '17 at 16:38
  • You mean a DescribeFeatureType request? – daan.desmedt Nov 8 '17 at 16:40
  • yes that is right – Ian Turton Nov 8 '17 at 16:43
2

BBOX is making a comparison of the bounding boxes of the features intersect and Intersects is checking if the features really intersect. In your case the features are very large multipolygons with huge bounding boxes. Therefore both the empty result from Intersects and 5 features with BBOX are correct.

Your search box is too little to even show in this picture but it is there inside all the big boxes.

enter image description here

  • I'm just a little confused... When showing the WFS layers on the map ... I don't see these large bounding boxes... They seem to reseemble in very small polygons... What the best way to show what you have shown above inside QGIS? – daan.desmedt Nov 9 '17 at 7:25
  • 2
    Bounding boxes in the image are created with an Envelope function. The features from the WFS are multipolygons, collection of polygons. The envelope function creates a rectangle that contains all the member polygons which belong to each multipolygon. I made them for visualizing the situation, they are not native geometries from WFS. – user30184 Nov 9 '17 at 8:16
3

I think you are being bitten by loose bounding box comparisons since technically this polygon doesn't intersect any features.

POLYGON((123664.03100000322 210489.5150000006,
     123705.24599999934 210489.5150000006,
     123705.24599999934 210587.86800000072,
     123664.03100000322 210587.86800000072,
     123664.03100000322 210489.5150000006))

enter image description here

But if I draw an arbitrary polygon I get features back:

http://services.ovam.be/geoserver/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=1.1.0&MAXFEATURES=9999&CRS=EPSG:31370&OUTPUTFORMAT=json&TYPENAME=OVAM:Dossierinfo&PROPERTYNAME=(gid,dossier_id,dossier_obo,dossier_bbo,dossier_bsp,dossier_eeo,dossier_status,status_jaar,dossier_type)&CQL_FILTER=INTERSECTS(geom,Polygon%20((102762.02686540392460302%20212444.74806031060870737,%20116556.8998131232074229%20211746.27348067925777286,%20116382.28116821536968928%20183283.43436070147436112,%2099968.12854687849176116%20183458.05300560931209475,%20102762.02686540392460302%20212444.74806031060870737))) 

So the filter is working. Thus I went back to look more closely at the results returned by the bbox query and found this when I filtered the Qgis map using

"dossier_id"  IN (50352,30220,26997,16231,21859)

I get a map like this (I've ringed your box in red):

enter image description here

So as you can see there is an 'interaction' between the bounds there is no actual intersection of the features which is what the filter tests. For speed GeoServer only considers the bounding boxes when you use a bounding box on the query.

  • Thanks for your feedback. Since i'm really no expert at this ... I'm trying to follow what you are explaining... But missing some things for now ... What tools do you use to draw the maps and bounding boxes? :) – daan.desmedt Nov 8 '17 at 17:27
  • I used Qgis but any GIS should be able to do it. – Ian Turton Nov 8 '17 at 17:36

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.