Geotools users,

Does anyone have an example of how to use the During filter in GeoTools?  I'm 
struggling to find a working example on the internet.

Here's what I've tried:

FilterFactory2 ff = 
CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
PropertyName propertyName = ff.property("DATE_LOADED");
DateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date date1 = FORMAT.parse("2010-07-05T12:08:56Z");
Instant temporalInstant1 = new DefaultInstant(new DefaultPosition(date1));

Date date2 = FORMAT.parse("2014-01-01T00:00:00Z");
Instant temporalInstant2 = new DefaultInstant(new DefaultPosition(date2));
Period period = new DefaultPeriod(temporalInstant1, temporalInstant2);

Filter filter = ff.during(propertyName, ff.literal(period));
query.setFilter(filter);
query.setPropertyNames(new String[]{"DATE_LOADED"});

Thanks,

Mike

________________________________

This e-mail and any files transmitted with it may be proprietary and are 
intended solely for the use of the individual or entity to whom they are 
addressed. If you have received this e-mail in error please notify the sender. 
Please note that any views or opinions presented in this e-mail are solely 
those of the author and do not necessarily represent those of Exelis Inc. The 
recipient should check this e-mail and any attachments for the presence of 
viruses. Exelis Inc. accepts no liability for any damage caused by any virus 
transmitted by this e-mail.
------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to