WFS bbox query - srid always null - no results, returned

View: New views
5 Messages — Rating Filter:   Alert me  

WFS bbox query - srid always null - no results, returned

by ewald16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi list,

We'd like to ask for advise on a problem with our Geoserver WFS requests.

our setup is as follows:

- GeoServer 2.0 (October 21, 2009)
- PostGIS database with a table containing a geom column for points
- Created layer in GeoServer admin interface that is connected to that table
    - Declared SRS is EPSG:4326
    - Bounding Boxes have been automatically derived from table and
correspond to real bounds (ie, they include all data points (0,0 - 299,299)

Now I would like to query for features within a specified bounding box.
This does not work (as expected).


Query without bbox works (50 features are returned):

http://localhost:9080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=abc:layer1&propertyName=genre_id,uri,geom&maxfeatures=50



Query with bbox filter returns empty result (no exception or error)

http://localhost:9080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=abc:layer1&propertyName=genre_id,uri,geom&maxfeatures=50&srsName=EPSG:4326&bbox=1,1,10,10

------------

I have digged myself a bit to the internals and tracked down the problem
to that issue:

Geoserver's PostGIS query contains an intersection (&&) where clause
looking like:

WHERE "geom" &&  GeomFromText('POLYGON ((1 1, 1 10, 10 10, 10 1, 1 1))',
<b>null</b>)

(note the null).

If i replace the <b>null </b>with a <b>-1</b>, or if I use the
1-param-version of GeomFromText  it works as expected.

I wonder why GeoServer insists on using null in the query, even though
the srid is specified in the URL (srsName=EPSG:4326). This is also
backed up by the geoserver log itself:

query = [net.opengis.wfs.impl.QueryTypeImpl@4300e4b3 (group: null,
propertyName: [genre_id, uri, geom], function: null, filter: [  bbox
POLYGON ((1 1, 1 10, 10 10, 10 1, 1 1)) ], sortBy:
[org.geotools.filter.SortByImpl@6fa6c622], featureVersion: null, handle:
null, <b>srsName: EPSG:4326</b>, typeName: [{http://dummy.com}layer1])]

Any insight is appreciated.

best,
ewald


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: WFS bbox query - srid always null - no results, returned

by ewald16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>
> WHERE "geom" &&  GeomFromText('POLYGON ((1 1, 1 10, 10 10, 10 1, 1 1))',
> <b>null</b>)

(Please disregard the HTML markups, they are not part of the query of
course)

-e

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: WFS bbox query - srid always null - no results, returned

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ewald Peiszer ha scritto:

> Hi list,
>
> We'd like to ask for advise on a problem with our Geoserver WFS requests.
>
> our setup is as follows:
>
> - GeoServer 2.0 (October 21, 2009)
> - PostGIS database with a table containing a geom column for points
> - Created layer in GeoServer admin interface that is connected to that table
>     - Declared SRS is EPSG:4326
>     - Bounding Boxes have been automatically derived from table and
> correspond to real bounds (ie, they include all data points (0,0 - 299,299)
>
> Now I would like to query for features within a specified bounding box.
> This does not work (as expected).
>
>
> Query without bbox works (50 features are returned):
>
> http://localhost:9080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=abc:layer1&propertyName=genre_id,uri,geom&maxfeatures=50
>
>
>
> Query with bbox filter returns empty result (no exception or error)
>
> http://localhost:9080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=abc:layer1&propertyName=genre_id,uri,geom&maxfeatures=50&srsName=EPSG:4326&bbox=1,1,10,10
>
> ------------
>
> I have digged myself a bit to the internals and tracked down the problem
> to that issue:
>
> Geoserver's PostGIS query contains an intersection (&&) where clause
> looking like:
>
> WHERE "geom" &&  GeomFromText('POLYGON ((1 1, 1 10, 10 10, 10 1, 1 1))',
> <b>null</b>)
>
> (note the null).
>
> If i replace the <b>null </b>with a <b>-1</b>, or if I use the
> 1-param-version of GeomFromText  it works as expected.
>
> I wonder why GeoServer insists on using null in the query, even though
> the srid is specified in the URL (srsName=EPSG:4326). This is also
> backed up by the geoserver log itself:

What you declare in the query is completely irrelevant, as it's often
the case the backend has a different set of referencing system
definitions that do not use the EPSG codes. GS has thus a full
separation between the "declared" world you expose to users and the
"backend" world where data is managed (the typical case of this
duality is Oracle and ESRI with their custom codes).

GeoServer is setup to respect the srid declared in the geometry_columns
metadata table which, I guess, is not there in your case.
Properly declare metadata for your table, restart GS, and you should
be fine.

In GeoServer 2.0.1 we'll add back an heuristics that assumes the srid
of the first data row in the table should the admin forgot to add
metadata information in the database.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: WFS bbox query - srid always null - no results, returned

by ewald16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> GeoServer is setup to respect the srid declared in the geometry_columns
> metadata table which, I guess, is not there in your case.
> Properly declare metadata for your table, restart GS, and you should
> be fine.
Indeed, the problem occured very early, when I followed the instruction
in the postgis faq to declare a geom column. They use -1 in their
example and it seems it is not possible to change that afterwards.

Anyway, I re-created the table and the data (had to reference the SRID
for each datarecord with ST_SetSRID), the GS data store and layer and
now it works like a charm.

Thanks for your help.

best,
Ewald


>
> In GeoServer 2.0.1 we'll add back an heuristics that assumes the srid
> of the first data row in the table should the admin forgot to add
> metadata information in the database.
>
> Cheers
> Andrea
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Re: WFS bbox query - srid always null - no results, returned

by Andrea Aime-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ewald Peiszer ha scritto:

>> GeoServer is setup to respect the srid declared in the geometry_columns
>> metadata table which, I guess, is not there in your case.
>> Properly declare metadata for your table, restart GS, and you should
>> be fine.
> Indeed, the problem occured very early, when I followed the instruction
> in the postgis faq to declare a geom column. They use -1 in their
> example and it seems it is not possible to change that afterwards.
>
> Anyway, I re-created the table and the data (had to reference the SRID
> for each datarecord with ST_SetSRID), the GS data store and layer and
> now it works like a charm.

Aah, so you had the metadata set. I think you were caught by
http://jira.codehaus.org/browse/GEOS-3626
then, which  been fixed in the meantime.

If anybody has the same situation as Ewald and could try out a nightly
build at http://gridlock.openplans.org/geoserver/2.0.x/ it would be
appreciated

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@...
https://lists.sourceforge.net/lists/listinfo/geoserver-users