The final statement in this code fragment:
final Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
cal.set(Calendar.YEAR, 2000);
final FeatureSource source = data.getFeatureSource(typeName);
final FilterFactory ff =
CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
final Expression left = ff.property("timestamp");
final Expression right = ff.literal(cal);
final Filter filter = ff.greaterOrEqual(left, right);
final SortBy sort = ff.sort("timestamp", SortOrder.DESCENDING);
final DefaultQuery query = new DefaultQuery("features", filter);
query.setSortBy(new SortBy[] { sort });
final FeatureCollection fc = source.getFeatures(query);
final boolean empty = fc.isEmpty();
throws:
java.lang.IllegalArgumentException: Property 'timestamp' could not be found
in features
at
org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor.visit(PostPreProcessFilterSplittingVisitor.java:773)
at
org.geotools.filter.AttributeExpressionImpl.accept(AttributeExpressionImpl.java:275)
at
org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor.visitBinaryComparisonOperator(PostPreProcessFilterSplittingVisitor.java:440)
at
org.geotools.filter.visitor.PostPreProcessFilterSplittingVisitor.visit(PostPreProcessFilterSplittingVisitor.java:406)
at
org.geotools.filter.IsGreaterThanOrEqualToImpl.accept(IsGreaterThanOrEqualToImpl.java:49)
at
org.geotools.data.jdbc.DefaultSQLBuilder.splitFilter(DefaultSQLBuilder.java:157)
at
org.geotools.data.jdbc.DefaultSQLBuilder.getPreQueryFilter(DefaultSQLBuilder.java:141)
at
org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore.java:563)
at
org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollection.java:80)
at
org.geotools.data.store.DataFeatureCollection.isEmpty(DataFeatureCollection.java:319)
But the timestamp field is really there in the features table in my
PostGIS data store. I get the same exception for e.g. fc.size() and
fc.features(). If I change the last two statements to:
final FeatureCollection fc = source.getFeatures();
final boolean empty = fc.isEmpty();
i.e. remove the query, it just works. This is with gt2-2.4-M4.
Does anyone one what could cause this behaviour?
Regards,
--
-- Gertjan van Oosten, [EMAIL PROTECTED], West Consulting B.V., +31 15 2191 600
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel