As quoted from Gertjan van Oosten <[EMAIL PROTECTED]>:
> 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();
I did some more investigating, and it also fails if I use a simple
filter on a text field like:
final Expression left = ff.property("name");
final Expression right = ff.literal("test");
final Filter filter = ff.equals(left, right);
final FeatureCollection fc = source.getFeatures(filter);
final boolean empty = fc.isEmpty();
It still throws
java.lang.IllegalArgumentException: Property 'name' could not be found in
features
As I said:
final FeatureCollection fc = source.getFeatures();
final boolean empty = fc.isEmpty();
i.e. without a filter, works and returns all features. *With* a filter
however, it fails. If I use tcpdump to check what goes over the wire to
the PostGIS data store, I don't see any SQL query being sent (without
the filter I do). The last thing that gets over the wire is:
SELECT srid FROM geometry_columns WHERE f_table_schema='public' AND
f_table_name='features' AND f_geometry_column='geom'
and the answer comes back with an srid of 4326. After that, nothing...
So it appears it isn't actually querying the database but just throws
the exception. Is there a way to get some debug logging out of gt2 to
see what goes on?
Regards,
--
-- Gertjan van Oosten, [EMAIL PROTECTED], West Consulting B.V., +31 15 2191 600
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel