Hi All
I have created a feature type that is based on a PostGIS table with a geometry column. Now I am showing this layer in the UI. Now I want to filter the number of rows selected in the table. Basically I want to add dynamic where clauses to the table SELECT clause. This is dynamic because teh where clause values will be based on user input in the UI. So please let me know how to filter data from database based on where conditions.
Thanks in advance
ganesh
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Hi Ganesh,
with geotools, instead of submiting a sql where clause directly to the
database, you have to use a higher level abstraction called Filter.
A Filter is a predicate over a FeatureType, you'll find some useful
information here: http://docs.codehaus.org/display/GEOTDOC/02+Filter
hope that helps,
Gabriel
On Monday 05 November 2007 07:21:55 pm Ganesh Jothikumar wrote:
Hi All
I have created a feature type that is based on a PostGIS table
with a geometry column. Now I am showing this layer in the UI. Now I want
to filter the number of rows selected in the table. Basically I want to
add dynamic where clauses to the table SELECT clause. This is dynamic
because teh where clause values will be based on user input in the UI. So
please let me know how to filter data from database based on where
conditions.
Thanks in advance
ganesh
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Ganesh Jothikumar ha scritto:
Hi All
I have created a feature type that is based on a PostGIS table with a geometry column. Now I am showing this layer in the UI. Now I want to filter the number of rows selected in the table. Basically I want to add dynamic where clauses to the table SELECT clause. This is dynamic because teh where clause values will be based on user input in the UI. So please let me know how to filter data from database based on where conditions.
You don't say if you're doing WMS or WFS requests.
If WFS, that comes with the protocol, have a look at the WFS specification (http://portal.opengeospatial.org/files/?artifact_id=7176)
and at the sample WFS requests we ship with GeoServer.
If you're talking about WMS, the standard way to do so would be to
provide an SLD parameter where you restate completely your styling
for the map (look for the &sld=xxx parameter description in our wiki).
If you can go out of the standard, we have custom extensions to the
GetMap call that allow to append a filter like in WFS, have a look
here:
http://docs.codehaus.org/display/GEOSDOC/WMS+vendor+parameters
Again, we have demos among the sample requests in the standard
distribution.
Cheers
Andrea