Thanks for your reply. I understand that, but I expect of a call to source.getFeatures(filter) on a ShapefileFeatureSource with an ongoing transaction, that I only get the features, that the filter accepts. At the moment it gives back the correctly filtered features not modified or added inside the current transaction (the ones that were in the shapefile before) and all features added or modified inside the current transaction (without regarding the filter, see my first mail). So the function getFeatures(filter) in connection with a transaction on the ShapefileFeatureSource is not working as expected.
If I would like to get all features source.getFeatures() would be the right thing to call. Von: Jody Garnett <[email protected]> Gesendet: Donnerstag, 29. November 2018 02:11 An: Peilke, Hendrik <[email protected]> Cc: GeoTools Developers <[email protected]> Betreff: Re: [Geotools-devel] Shapefile datastore does not support transactions and filters correctly At some level the writer needs to read over all the features (it needs to write out all the features), so passing a filter into the reader may act as a delete. On Tue, Nov 27, 2018 at 1:37 AM Peilke, Hendrik <[email protected]<mailto:[email protected]>> wrote: Hi, I use a shapefile datastore in conjunction with a transaction. When reading features of the store, using a filter, I mentioned, that if I have a dirty state (added or modified features) in the transaction I always get all features returned regardless of the filter. I figured out that the problem lies inside ContentFeatureSource (https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/store/ContentFeatureSource.java): When getReader(Query query) gets called, it sets in the transaction part the reader to new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, state.getDiff()); The query is not passed to the DiffFeatureReader resulting in a Filter.INCLUDE filter inside the DiffFeatureReader (https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java), always returing all features. In some cases this seems to be handled in some cases inside the getReader(Query query) in the block following the transaction block, where it adds a new FilteringFeatureReader on top of the current reader. The problem is, for shapefiles it never gets there, because canFilter() resolves to true. My suggestion is to pass the filtert o the DiffFeatureReader by calling new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, state.getDiff(), query.getFilter()); Would that be the right way? Regards, Hendrik Peilke ________________________________ IBYKUS AG für Informationstechnologie, Erfurt / HRB 108616 - D-Jena / Vorstand: Helmut C. Henkel, Dr. Lutz Richter, Eckehart Klingner Vorsitzender des Aufsichtsrates: Dr. Helmut Vorndran _______________________________________________ GeoTools-Devel mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/geotools-devel ________________________________ IBYKUS AG für Informationstechnologie, Erfurt / HRB 108616 - D-Jena / Vorstand: Helmut C. Henkel, Dr. Lutz Richter, Eckehart Klingner Vorsitzender des Aufsichtsrates: Dr. Helmut Vorndran
_______________________________________________ GeoTools-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
