[Geoserver-users] Filtering features with SLD

Hi,

I am using SLD with filters based on properties of the features. Geoserver works great using them, but when you have a lot of data behind it starts getting slow...
I think I already asked if filters where gonna be interpreted by Geoserver in the SQL sent to PostGIS or after. Now filters are done in java after fetching all data from the database.
It is a problem in my case because I have a table with around 1.5 million features and I need to create maps filtering by one of its properties. If the bounding box is small then there is no problem because not so much data is fetched from the database and filter by geoaserver, but if the bounding box is big then fetching the 1.5 million records is just too slow...

More info. I am setting the filter in the request by doing something like:
http://geoserver/wms?service=Getmap...SLD=http//slds/features_by_taxon.php?taxon=Laala

The SLD as you see is a document generated dynamically with PHP (it just takes the parameter and put it inside). I need to do it like this because SLD_BODY would get too long (the style apart of filtering is pretty long).

I was wondering if anybody has any idea on how to do something like this now. I even have thought on creating PostGIS views and dynamically register them in Geoserver all in one request! But then I though that is a little bit crazy...
Any hint where could I hack the geoaserver code? (I would prefer to avoid this!)

Thanks.

Javier.

Hi,

I am using SLD with filters based on properties of the features. Geoserver works great using them, but when you have a lot of data behind it starts getting slow...
I think I already asked if filters where gonna be interpreted by Geoserver in the SQL sent to PostGIS or after. Now filters are done in java after fetching all data from the database.
It is a problem in my case because I have a table with around 1.5 million features and I need to create maps filtering by one of its properties. If the bounding box is small then there is no problem because not so much data is fetched from the database and filter by geoaserver, but if the bounding box is big then fetching the 1.5 million records is just too slow...

More info. I am setting the filter in the request by doing something like:
http://geoserver/wms?service=Getmap...SLD=http//slds/features_by_taxon.php?taxon=Laala

The SLD as you see is a document generated dynamically with PHP (it just takes the parameter and put it inside). I need to do it like this because SLD_BODY would get too long (the style apart of filtering is pretty long).

I was wondering if anybody has any idea on how to do something like this now. I even have thought on creating PostGIS views and dynamically register them in Geoserver all in one request! But then I though that is a little bit crazy...
Any hint where could I hack the geoaserver code? (I would prefer to avoid this!)

Thanks.

Javier.

On 5/22/06, Javier de la Torre <jatorre@...546...> wrote:

Hi,

I am using SLD with filters based on properties of the features.
Geoserver works great using them, but when you have a lot of data
behind it starts getting slow...
I think I already asked if filters where gonna be interpreted by
Geoserver in the SQL sent to PostGIS or after. Now filters are done
in java after fetching all data from the database.

With a GetFeature request, the SLD filter becomes part of the SQL
statement sent to PostGIS. Last time I checked (and I really hope I am
wrong about this), during a GetMap request the SLD filter is not part
of the SQL sent to PostGIS, and it (the filter) is applied after all
data has been retrieved.

There was a discussion in favor of changing this, but I don't know if
the change is now implemented.

It is a problem in my case because I have a table with around 1.5
million features and I need to create maps filtering by one of its
properties. If the bounding box is small then there is no problem
because not so much data is fetched from the database and filter by
geoaserver, but if the bounding box is big then fetching the 1.5
million records is just too slow...

More info. I am setting the filter in the request by doing something
like:
http://geoserver/wms?service=Getmap...SLD=http//slds/
features_by_taxon.php?taxon=Laala

The SLD as you see is a document generated dynamically with PHP (it
just takes the parameter and put it inside). I need to do it like
this because SLD_BODY would get too long (the style apart of
filtering is pretty long).

I was wondering if anybody has any idea on how to do something like
this now. I even have thought on creating PostGIS views and
dynamically register them in Geoserver all in one request! But then I
though that is a little bit crazy...

Currently, I use RMI to (re)create views in PostGIS. It works, but
still--a hack is a hack.

Any hint where could I hack the geoaserver code? (I would prefer to
avoid this!)

Uhm, I believe David Blasby can point you in the right direction.

Alex

Hi Alex,

With a GetFeature request, the SLD filter becomes part of the SQL
statement sent to PostGIS. Last time I checked (and I really hope I am
wrong about this), during a GetMap request the SLD filter is not part
of the SQL sent to PostGIS, and it (the filter) is applied after all
data has been retrieved.

Yes, I know... But I need to get a map, not the data...

There was a discussion in favor of changing this, but I don't know if
the change is now implemented.

I suppose the thing is that this is not that easy to implement... Some
filters can have things that can only be interpreteated after fetching
the data and there is also the thing that Geoserver not only handles
PostGIS datastore so probably the filtering or PotGIS is the same as
for Shapefiles... and of course the second are only filtered after
fetching the whole file...

Thanks.

Javier.