I figured it out.. For anyone who's interested, here's the solution:

 

 

                                    FilterFactory2 ff2 =
CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());

                  Expression stateProperty = ff2.property("STATEFP");

                  Expression stateValue =
ff2.literal(usCensusState.getCensusCode());

                  Filter stateFilter = ff2.equals(stateProperty,
stateValue);

                  

                  Filter nameFilter = ff2.equal(ff2.property("NAME"),
ff2.literal(cityname), false);

                  geoFilter = ff2.and(stateFilter, nameFilter);

 

You'll notice that my nameFilter was created with a "false" flag for a
case-insensitive match..  I couldn't find the javadoc, but here's where
I found the example:

 

http://docs.codehaus.org/display/GEOTDOC/Filter+Examples

 

 

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Angel, Eric
Sent: Wednesday, June 25, 2008 5:10 PM
To: [email protected]
Subject: [Geotools-gt2-users] Case Insensitive property filter

 

Hey guys,

 

I'm using GT 2.4 and trying to filter by a property, but I don't want it
to be case - sensitive... This is the code I'm using:

 

                                    FilterFactory2 ff2 =
CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());

                  Expression stateProperty = ff2.property("STATEFP");

                  Expression stateValue =
ff2.literal(usCensusState.getCensusCode());

                  Filter stateFilter = ff2.equals(stateProperty,
stateValue);

                  

                  Expression nameProperty = ff2.property("NAME");

                  Filter nameFilter = ff2.like(nameProperty, cityname);

                  geoFilter = ff2.and(stateFilter, nameFilter);

 

I read this thread, but I didn't find any solution..

 

http://www.mail-archive.com/[email protected]/msg
03575.html

 

Thanks,

 

Eric

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to