Andrea Aime ha scritto: >> For example: >> >> SELECT id, name, url, ST_SetSRID(ST_Point(longitude, latitude),4326) as >> location FROM non_spatial_table; >> >> where longitude and latitude are numeric columns. > > You can, but it would not be worth using performance wise. > For example, a bbox filter against the feature type defined > above would be turned into the following sql query: > > select id, name, url, location > from > ( > SELECT id, name, url, > ST_SetSRID(ST_Point(longitude, latitude),4326) as location > FROM non_spatial_table) > ) > where location && <the bbox> > > which would not give enough info to the db to turn that > into a filter against longitude and latitude.
Thinking thinking, evil thinking... Since we're already giving the user the control to make her own query, what about giving her the tools to make her own optimizations as well? What if, for example, we allow a variable substitution mechanism based on the simplest and more common filter, the bbox one? 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, and then the user could give the jdbc datastore something like: 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} or something like: select id, st_buffer(geometry, 1500), name from my_spatial_table where flow > 143 {and geometry && $bbox} Assuming the $bbox would be expanded into the literal representation of a bounding box for that database (using the sql dialect). Or, to make things a little easier for us, we pass down $minx, $miny, $maxx, $maxy and let the user build whatever she feels like with them. Too evil? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Download Intel® 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 _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel