[Geoserver-users] Problems with PostGIS WFS bbox

Hello All,

First off I would like to say that I started using Geoserver last week
and I am thrilled with the amount of functionality I've been able to
get out of it with so little effort. Kudos to the development team.

I am trying to access all the features within a bounding box of my
data set via WFS. I have the same data set loaded in under two
different data stores, one as a shapefile and one as PostGIS. The
shapefile datastore works as expected, but the PostGIS datastore seems
to ignore the bbox.

I can access the shapefile with the following URL and I receive the
expected subset of my data:
http://yubyub.dyndns.org:8080/geoserver/wfs?version=1.0.0&bbox=-77,38.9,-76.9,39&request=GetFeature&service=WFS&typename=regional_bike

I can access the PostGIS data with the following URL, but it returns
ALL of the records:
http://yubyub.dyndns.org:8080/geoserver/wfs?version=1.0.0&bbox=-77,38.9,-76.9,39&request=GetFeature&service=WFS&typename=bike_path

I have tested PostGIS manually from psql with the following select
statement and received the exected response:
select count(gid) from bike_path where the_geom && 'BOX3D(-77.0 38.9,
-76.9 39)'::box3d;
count
-------
    94
(1 row)

After scratching my head a bit I turned on the FINE debug messages in
geoserver and noticed that there is no where clause (WHERE TRUE) with
the PostGIS select statement. Out of curiousity I also tried turning
the loose bbox option on and off for the PostGIS datasource -- to no
effect.

I would appreciate any help you can give me. I have included some log
messages and version numbers below for reference.

Thanks in advance,

-jason

GeoServer 1.3.4
PostgreSQL 8.1.4
geos 2.2.1
PostGIS 1.1.4
Fedora Core 4

2990532 [INFO] org.vfny.geoserver.servlets.AbstractService - handling request:
Request: null
output format:GML2
max features:2147483647
version:1.0.0
queries:
  Query
   feature type: bike_path
   filter: [ null intersects POLYGON ((-77 38.9, -77 39, -76.9 39,
-76.9 38.9, -77 38.9)) ]
   [properties: ALL ]

2990533 [FINE] org.vfny.geoserver.servlets.AbstractService - strategy
is: org.vfny.geoserver.servlets.PartialBufferStrategy@anonymised.com
2990533 [FINER] org.vfny.geoserver.servlets.AbstractService - executing request
2990534 [FINE] org.vfny.geoserver.global.Data - getting type bike_path
2990535 [FINE] org.geotools.data.postgis.PostgisDataStore - get
Feature source called on bike_path
2990535 [FINE] org.geotools.data.postgis.PostgisDataStore - returning
pg feature locking
2990536 [FINE] org.vfny.geoserver.wfs.responses.FeatureResponse - Query is
  Query
   feature type: bike_path
   filter: [ null intersects POLYGON ((-77 38.9, -77 39, -76.9 39,
-76.9 38.9, -77 38.9)) ]
   [properties: ALL ]
To gt2: Query:
   feature type: bike_path
   filter: [ null intersects POLYGON ((-77 38.9, -77 39, -76.9 39,
-76.9 38.9, -77 38.9)) ]
   [properties: ALL ]
2990537 [FINE] org.geotools.data.postgis.PostgisDataStore - get
Feature source called on bike_path
2990537 [FINE] org.geotools.data.postgis.PostgisDataStore - returning
pg feature locking
2990537 [FINER] org.vfny.geoserver.servlets.AbstractService - execution succeed
2990541 [FINER] org.vfny.geoserver.servlets.AbstractService - strategy
output is: org.vfny.geoserver.util.PartialBufferedOutputStream
2990542 [FINE] org.vfny.geoserver.servlets.AbstractService - mime type
is: text/xml; charset=UTF-8
2990545 [FINE] org.geotools.data.jdbc.JDBC1DataStore - calling sql
builder with filter Filter.NONE
2990545 [FINER] AbstractFilter - ENTRY 12,345
2990546 [FINE] org.geotools.data.jdbc.JDBC1DataStore - sql is SELECT
"gid", "length", "from_st", "to_st", "name", "signed", "length_mi",
"juris", "type", encode(AsBinary(force_2d("the_geom"),
'XDR'),'base64') FROM "public"."bike_path" WHERE TRUE
2990546 [FINE] org.geotools.data.jdbc.JDBC1DataStore - About to
execute query: SELECT "gid", "length", "from_st", "to_st", "name",
"signed", "length_mi", "juris", "type",
encode(AsBinary(force_2d("the_geom"), 'XDR'),'base64') FROM
"public"."bike_path" WHERE TRUE
2990546 [FINE] org.geotools.data.jdbc.ConnectionPool - Getting
available connection.
2991078 [FINE] org.geotools.data.jdbc.ConnectionPool$ConnectionListManager
- Connection closed - adding to available connections.
2991079 [FINE] org.geotools.data.jdbc.JDBC1DataStore - calling sql
builder with filter Filter.NONE
2991080 [FINER] AbstractFilter - ENTRY 12,345
2991080 [FINE] org.geotools.data.jdbc.JDBC1DataStore - sql is SELECT
"gid", "length", "from_st", "to_st", "name", "signed", "length_mi",
"juris", "type", encode(AsBinary(force_2d("the_geom"),
'XDR'),'base64') FROM "public"."bike_path" WHERE TRUE
2991107 [FINE] org.geotools.data.jdbc.JDBC1DataStore - About to
execute query: SELECT "gid", "length", "from_st", "to_st", "name",
"signed", "length_mi", "juris", "type",
encode(AsBinary(force_2d("the_geom"), 'XDR'),'base64') FROM
"public"."bike_path" WHERE TRUE
2991108 [FINE] org.geotools.data.jdbc.ConnectionPool - Getting
available connection.

Jason Surratt ha scritto:

Hello All,

First off I would like to say that I started using Geoserver last week
and I am thrilled with the amount of functionality I've been able to
get out of it with so little effort. Kudos to the development team.

I am trying to access all the features within a bounding box of my
data set via WFS. I have the same data set loaded in under two
different data stores, one as a shapefile and one as PostGIS. The
shapefile datastore works as expected, but the PostGIS datastore seems
to ignore the bbox.

I can access the shapefile with the following URL and I receive the
expected subset of my data:
http://yubyub.dyndns.org:8080/geoserver/wfs?version=1.0.0&bbox=-77,38.9,-76.9,39&request=GetFeature&service=WFS&typename=regional_bike

I can access the PostGIS data with the following URL, but it returns
ALL of the records:
http://yubyub.dyndns.org:8080/geoserver/wfs?version=1.0.0&bbox=-77,38.9,-76.9,39&request=GetFeature&service=WFS&typename=bike_path

This is strange... may it be a CRS problem?
Which is the CRS you declared in your postgis tables?
Cheers
Andrea

This is strange... may it be a CRS problem?
Which is the CRS you declared in your postgis tables?

Andrea,

I've seen CRS referenced quite a bit, but I haven't found a very good
definition. I assume it is synonymous with SRID & SRS.

All my data (both shapefiles and database) are in WGS1984 (EPSG:4326).
I've verified that the SRS field in geoserver and the geometry_columns
table have a value of 4326. I also verified that SRID 4326 is
populated with what appears to be the correct values in the
spatial_ref_sys table in PostGIS. I've also found some post that
suggest that leaving the SRID as -1 or 0 makes things easier to digest
for geoserver, neither seems to make a difference.

Is this what you were refering to?

Thanks!

-jason

Could you try it with a post request? See if it works then?

There should be a sample bbox request in Demo -> Sample Requests. Just adjust to your params.

I think Oracle was actually having similar problems, something in the code must have changed. Sounds like a bug, if you get proper results with the post (and also try a get request with the full filter instead of the shorthand bbox=), then this is definitely a bug with that type of request (which is a tricky one as it requires us to figure out the default geometry).

Chris

Jason Surratt wrote:

This is strange... may it be a CRS problem?
Which is the CRS you declared in your postgis tables?

Andrea,

I've seen CRS referenced quite a bit, but I haven't found a very good
definition. I assume it is synonymous with SRID & SRS.

All my data (both shapefiles and database) are in WGS1984 (EPSG:4326).
I've verified that the SRS field in geoserver and the geometry_columns
table have a value of 4326. I also verified that SRID 4326 is
populated with what appears to be the correct values in the
spatial_ref_sys table in PostGIS. I've also found some post that
suggest that leaving the SRID as -1 or 0 makes things easier to digest
for geoserver, neither seems to make a difference.

Is this what you were refering to?

Thanks!

-jason

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:1003,4527e79a276087785049143!

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org