I am building a simple web-based query interface to GeoServer v.1.6.3,
submitting a WFS query to find features inside a polygon drawn on the GUI
(OpenLayers). This seems to work fine when the data is held in shapefiles,
but I get inconsistent results from feature data in a PostGIS-enabled
database when working with re-projected data.
I have used data from the same shapefile to set up two feature types, one
based on the shapefile itself, and another based on a PostGIS table created
from the same shapefile via shp2pgsql. The spatial coords are in SRS 27700
(GB national grid).
I'm testing the query by displaying the features on my OL map via WMS, so I
can see how many features should be inside my search polygon, and I run
exactly the same WFS query against the shapefile and DB feature types.
If the feature layers are defined using SRS 27700 for their output, then
both queries return consistent results. If I tell GeoServer to re-project
the data from SRS 27700 to SRS 4326, then the query against the shapefile
still returns the correct results, but the DB query does not - it seems to
return just a subset of the results I get from the shapefile query, as if
it's not spotting all the matching records in the DB query.
I'm guessing this might have something to do with how GeoServer performs the
re-projection for shapefile or PostGIS data when comparing the feature
coords and the search polygon coords during the query, but I'm new to this
stuff, so can anybody spot what the problem might be, and suggest how I
might fix it?
For now I can just restrict myself to using data in a single SRS, but a big
benefit of using GeoServer for my application is the ability to mix
different data sources/projections, so any help would be greatly
appreciated!
Thanks.
Chris
--
View this message in context: http://www.nabble.com/WFS-query-producing-inconsistent-results-from-shapefile-and-PostGIS-tp18689193p18689193.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
One more question:
Is it possible to specify an "ORDER BY" property for a WFS query e.g. to
sort the output results by a particular attribute? I've been Googling
around and there seem to be some vendor-specific options, but I can't tell
if GeoServer offers this.
Any ideas?
Thanks!
Chris
--
View this message in context: http://www.nabble.com/WFS-query-producing-inconsistent-results-from-shapefile-and-PostGIS-tp18689193p18696055.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
ChrisWebster ha scritto:
One more question:
Is it possible to specify an "ORDER BY" property for a WFS query e.g. to
sort the output results by a particular attribute? I've been Googling
around and there seem to be some vendor-specific options, but I can't tell
if GeoServer offers this.
Output sorting is part of the WFS 1.1 specification, thus we support
it for the WFS 1.1 queries, but only if they are made against a datastore that has native sorting abilities (for the moment, the DBMS ones).
As a side effect of how we implement things, sorting should be available
on WFS 1.0 as well when using GET requests, for details see the WFS
specification at: http://www.opengeospatial.org/standards/wfs
Cheers
Andrea
ChrisWebster ha scritto:
I am building a simple web-based query interface to GeoServer v.1.6.3,
submitting a WFS query to find features inside a polygon drawn on the GUI
(OpenLayers). This seems to work fine when the data is held in shapefiles,
but I get inconsistent results from feature data in a PostGIS-enabled
database when working with re-projected data.
I have used data from the same shapefile to set up two feature types, one
based on the shapefile itself, and another based on a PostGIS table created
from the same shapefile via shp2pgsql. The spatial coords are in SRS 27700
(GB national grid).
I'm testing the query by displaying the features on my OL map via WMS, so I
can see how many features should be inside my search polygon, and I run
exactly the same WFS query against the shapefile and DB feature types.
If the feature layers are defined using SRS 27700 for their output, then
both queries return consistent results. If I tell GeoServer to re-project
the data from SRS 27700 to SRS 4326, then the query against the shapefile
still returns the correct results, but the DB query does not - it seems to
return just a subset of the results I get from the shapefile query, as if
it's not spotting all the matching records in the DB query.
I'm guessing this might have something to do with how GeoServer performs the
re-projection for shapefile or PostGIS data when comparing the feature
coords and the search polygon coords during the query, but I'm new to this
stuff, so can anybody spot what the problem might be, and suggest how I
might fix it?
I never noticed this problem before, so I have no quick solution.
If you can, open a jira issue at jira.codehaus.org, attach some sample data and wfs requests that do show the problem, and I'll have a look at it.
Cheers
Andrea