Is there a performance difference between using CQL vs creating your own
filters?

I'm currently using the below code and it's really slow.

---------------
FilterFactory2 ff2 =
CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
                Expression stateProperty = ff2.property("STATE");
                Expression stateValue = ff2.literal(statecode);
                Filter stateFilter = ff2.equals(stateProperty,
stateValue);
                
                Filter nameFilter = ff2.equal(ff2.property("NAME"),
ff2.literal(cityname), false);
                geoFilter = ff2.and(stateFilter, nameFilter);
                
                FeatureSource featureSource =
ds.getFeatureSource(ds.getTypeNames()[0]);
                FeatureCollection featureCollection =
featureSource.getFeatures(geoFilter);
                FeatureIterator iterator = featureCollection.features();
-----------------

Is there a better way to do this if I'm doing this thousands of times
per minute?



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jody Garnett
Sent: Thursday, July 10, 2008 8:31 AM
To: Manfred PAUL
Cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] ArcSDE filter on shape

Yes - what you are referring to is handled by the Filter classes in 
GeoTools; they are based on some specification - here is a good overview

of different ways to create a Filter.
- http://docs.codehaus.org/display/GEOTDOC/Filter+Interfaces

One of the easier ways to start out with is using the "common query 
lanague" parser:
- http://docs.codehaus.org/display/GEOTDOC/14+CQL

The hard part is knowing what functions are available to use; so far 
this page offers the best list:
-
http://udig.refractions.net/confluence/display/EN/Common+Query+Language

So it look sike the following should work:

Filter filter = CQL.toFilter("geomLength( the_geom ) > 2000");
FeatureCollection features = featureSource.getFeatures( filter );


Manfred PAUL wrote:
>
>
> is there a possibility to do something like this:
>
> select...   where shape.length > 2000 with a  geotools filter?
>
> Regards Manfred
>
>
------------------------------------------------------------------------
>
>
------------------------------------------------------------------------
-
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>
------------------------------------------------------------------------
>
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>   
> ArcSDE filter on shapeHi,


------------------------------------------------------------------------
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to