From: Jody G. <jga...@re...> - 2007-08-02 04:58:00
|
Gabriella Turek wrote: > Jody Garnett wrote: > >> There is always the low tech solution ... just go through all the values >> and stick them into a set :-) >> > I was afraid you were going to say that :-) > The last link I gave you should have examples that work in GeoTools 2.2 (that is when it was written). Cory is the developer of these functions so he may be of more help then me. > But I still want to be able to get set a filter in the data store to > display data with a given attribute. > Right. > In other words, something like this should work, but I can't figure out > for the life of me what filter to use. > So if this was SQL you want to say something like: SELECT typeName WHERE TYPE='pole'? We have almost that exact example on the wiki - let me try? Filter filter = CQL.toFilter("TYPE == 'pole'"); FeatureSource fs = datastore.getFeatureSource(typeName); FeatureCollection fc = fs.getFeatures( filter); Or if we do it the long way using GeoTools 2.2 syntax: FilterFactory ff = FilterFactoryFinder.createFilterFactory(); CompareFilter filter = ff.createCompareFilter(Filter.COMPARE_EQUALS); filter.addLeftValue( ff.createAttributeExpression("TYPE")); filter.addRightValue( ff.createLiteralExpression("pole")); Cheers, Jody > Thanx > Gaby > > >> You are correct the developer introduced these things for 2.3 but never >> wrote down documentation - here is the original page: >> - http://docs.codehaus.org/display/GEOTOOLS/FeatureVisitor >> >> Perhaps that helps? >> Jody >> > \ > > |