Christian Müller ha scritto:
> Hmmmmmm
> And how do you rewrite a query if the bbox param is missing ?
> e.g
> where st_area($bbox) > 100000
> or
> where anAttr = aValue or <bbox expresion>
> or
> where anAttr = aValue and <bbox expresion>
> ?

That's why I enclosed the part with the bbox in { } and
said "We allow the user to add a special part of the definition query
that is actually expanded only if a bbox filter can be extracted
from the original gt2 query"

So if there is no bbox

select id, name, url,
         ST_SetSRID(ST_Point(longitude, latitude),4326) as location
from non_spatial_table
{where longitude >= $bbox.minx and longitude <= $bbox.maxx
     and latitude >= $bbox.miny and latitude <= $bbox.maxy}

becomes just:

select id, name, url,
         ST_SetSRID(ST_Point(longitude, latitude),4326) as location
from non_spatial_table

In fact using just { } is probably a poor choice.

If we use minx, miny, max, maxy, srid instead of passing down a fully
encoded envelope  and use the {bbox} as the way to mark the
special portion of the query:

select id, name, url,
         ST_SetSRID(ST_Point(longitude, latitude),4326) as location
from non_spatial_table
{bbox} where longitude >= $minx and longitude <= $maxx
     and latitude >= $miny and latitude <= $maxy {bbox}

and

select id, st_buffer(geometry, 1500), name
from my_spatial_table
where flow > 143
{bbox}
and geometry && st_buffer(ST_MakeEnvelope($minx, $miny, $maxx, $maxy, 
$srid), 1500) {bbox}

If you don't want to add the optimization you just don't add the
{bbox}...{bbox} portion.

How does it look?

Cheers
Andrea



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

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to