Hello everyone.
We've been struggeling for a while with a strange behaviour with Geoserver and 
a specific filter that sometimes returns to few features. I'd like to ask you 
all for a sanity check of our situation, hopefully its something we done wrong 
but we don't see it. :(
We're running Geoserver 2.10.1 on Linux CentOS 64bit and Oracle java 8.

Background
======================================
We have an OpenLayers client in which the user clicks a polygon/multipolygon 
layer.
For each click we want to find every surface in a specific layer (in the 
example below Multipolygon_query_layer) that relates to the surface the user 
clicked (being related basically means being contained within the polygon or 
overlapping it quite a bit (not just by overlapping with a tiny amount)).

To do this we make a WFS-request to Geoserver with a filter containing the 
geometry from the feature we clicked (filtergeometry). The request should 
return all features (f) where:
area(intersection(f.geometry, filtergeometry)) >= area(filtergeometry) * 0.1
The idea is to ignore any geometries that just barely sticks into 
filtergeometry by requiring that the area of the intersection is at least 10% 
of the filtergeometry's area.

I have made two tests cases which should both work but where only one does and 
I can't understand why.
All files referenced below are included in the attached rarfile.

Both examples uses the shapefile "Multipolygon_query_layer" imported into a 
postgislayer and published in geoserver.
This file contains 4 features, (16-16, T16-16, 14-8, T14-8).

Lets start with the one that works.
======================================
In "14-8 WFS-filter and result.txt" there is a filter which I called with the 
democlient of Geoserver (demos->demo requests->WFS_getFeature-1.1.xml) and the 
result from that request.
The filter uses the geometry from 14-8 as a literal (in our real life example 
this comes from openlayers) and returns both features 14-8 and T14-8.
This behavior is consistent with querying the database with the following sql:

select aktnummer, intersection, areaIntersection, parentAreaTime10p, 
areaIntersection >=  parentAreaTime10p as intersectionLargerThan10p from (
select
allrows.aktnummer,
st_asewkt(st_intersection(allrows.the_geom, filter.the_geom)) as Intersection,
st_area(st_intersection(allrows.the_geom, filter.the_geom)) as areaIntersection,
st_area(filter.the_geom)*0.1 as parentAreaTime10p
from test.multipolygon_query_layer allrows, test.multipolygon_query_layer filter
where filter.aktnummer = '14-8'
) as foo

which yeilds:::
Aktnummer: 14-8
intersection: SRID=3011;POLYGON((139717.991700148 6563739.41352409, (...)
areaIntersection: 55783.0012207031 <-larger than parentAreaTime10p
parentAreaTime10p: 5578.30012207031
intersectionLargerThan10p: true <-true means the feature should be returned

Aktnummer: T14-8
intersection: SRID=3011;POLYGON((139662.752436996 6563892.11572879, (...)
areaIntersection: 7038.15582275391 <-larger than parentAreaTime10p
parentAreaTime10p: 5578.30012207031
intersectionLargerThan10p: true <-true means the feature should be returned

Ok, so everything is ok. Both SQL and WFS returns the two features.

And now to the one that does not work
=======================================
However when I do the same thing with 16-16 the feature T16-16 is'nt returned 
(see "16-16 WFS-filter and result.txt") even though the SQL query shows that 
they should both be returned.

select aktnummer, intersection, areaIntersection, parentAreaTime10p, 
areaIntersection >=  parentAreaTime10p as intersectionLargerThan10p from (
select
allrows.aktnummer,
st_asewkt(st_intersection(allrows.the_geom, filter.the_geom)) as Intersection,
st_area(st_intersection(allrows.the_geom, filter.the_geom)) as areaIntersection,
st_area(filter.the_geom)*0.1 as parentAreaTime10p
from test.multipolygon_query_layer allrows, test.multipolygon_query_layer filter
where filter.aktnummer = '16-16'
) as foo

which yeilds:::
Aktnummer: 16-16
intersection: SRID=3011;MULTIPOLYGON(((139930.498312621 6563798.77912457, (...)
areaIntersection: 137954.670837402; <-larger than parentAreaTime10p
parentAreaTime10p: 13795.4670837402;
intersectionLargerThan10p: true <-true means the feature should be returned

Aktnummer: T16-16
intersection: SRID=3011;POLYGON((139825.726520547 6563565.34409751, (...)
areaIntersection: 18087.5724487305; <-larger than parentAreaTime10p
parentAreaTime10p: 13795.4670837402
intersectionLargerThan10p: true <-true means the feature should be returned

The SQL shows that both features should be returned but only 16-16 is returned 
by the WFS-request.

Can anyone see why T16-16 is'nt returned by the getFeature request while being 
returned by the sqlquery?
We would really appriciate any help with this.
Lukas


Vänliga Hälsningar
Lukas
[http://www.decerno.se/images/decerno_logo_300.png]<http://www.decerno.se/>
Lukas Bergliden
Civilingenjör

Mobil             070 644 96 61         Electrum 234, 164 40 Kista
Direkt            08 630 75 09           Kistagången 16, 7 tr

Attachment: files.rar
Description: files.rar

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to