Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Shapefile layers, uncommitted features are affected by all operations. #348

Open
akater320 opened this issue Apr 30, 2019 · 10 comments
Open

Comments

@akater320
Copy link
Contributor

When editing a shapefile layer, uncommitted features are affected by (almost) all edit operations.
Examples:
Select any feature (e.g. polygon) in a shape file layer. That polygon plus all uncommitted polygons will be selected.
Attempt to delete any feature in a shapefile layer. That polygon plus all uncommitted polygons will be deleted.
Attempt to move/modify the geometry of any feature. All uncommitted features will be assigned a copy of the same geometry. The result is multiple features stacked on top of each other.

This seems to be caused by GeoTools not propagating the filter/query to the DiffFeatureReader. All features in the current transaction will be added to the returned iterator.
ContentFeatureSource.java

@nprigour
Copy link
Contributor

nprigour commented May 1, 2019

This is quite a serious bug. I just check it and indeed the behaviour if you try to edit more than one feature without prior committing the changes is really weird!
It seems also that the issue is present for quite some time, maybe from upgrading to geotools 19.x. I wonder how this got unoticed for such a long time (to be honest I work almost solely with jdbc layers where the problem seems not to be present)!!
@akater320 are you sure that the issue stems from the ContentFeatureStore? Moreover are you aware whether it has been fixed in subsequent geotools versions?
@fgdrf I think we should urgently ask a question about this to the geotools team and request their counsel.

@nprigour
Copy link
Contributor

nprigour commented May 1, 2019

Checking a little bit further it seems that we have this issue in udig even in version 2.0.0 that uses geotools 14.1. I had to go 4-5 years back in time that is udig 1.4 and geotools 9.0-M0 to see correct behavior during multiple edits of a shapefile layer!

@akater320
Copy link
Contributor Author

FYI: You may encounter this issue while testing with ShapeFiles.
geotools/geotools@a26e08b

@nprigour
Copy link
Contributor

nprigour commented May 1, 2019

But @akater320 I cannot understand if the problem is indeed where you mention, shouldn't all FeatureSources be affected since this method getReader is final and used by all FeatureSources that inherit from the ContentFeatureSource (that is to say all type of sources)? I.e. I work for some years with JDBCFeatureSources (MySQL) in udig and the problem surely not present there!

@nprigour
Copy link
Contributor

nprigour commented May 2, 2019

Hi @akater320,
Following your advice I checked by replacing the DiffFeatureReader constructor with the one that contains also the Filter parameter (in the suggested line 619 of ContentFeatureSource) and it seems that the problem is resolved in what concerns multiply editing actions in Shapefiles (JDBC layers also seem unaffected by this change). That is great!
@akater320 do you have an account in geotools project? If yes would it be possible to create a jira ticket in geotools (https://osgeo-org.atlassian.net/projects/GEOT/issues) describing the problem and possibly also referencing the present issue to justify the problem? Then you can proceed with providing a PR fix on geotools github.
Note: as far s I know, geotools is now in version 21.x which has a lot of changes compared to v19.4 used by udig (also it is probably not under support anymore) but I am sure the problem is still present. Anyway let's propose a fix and we may ask later how we can backport it to v19.x.

@akater320
Copy link
Contributor Author

https://osgeo-org.atlassian.net/projects/GEOT/issues/GEOT-6293

@nprigour
Copy link
Contributor

nprigour commented Oct 21, 2019

Hi @akater320,

would it be possible to revise the https://osgeo-org.atlassian.net/projects/GEOT/issues/GEOT-6293 jira issue according to what I am proposing in geotools/geotools#2604 (see my latest comment) so that we can proceed with the geotools fix. If you are unable to rename the issue and/or its description, please inform back so that I generate another one and we set the GEOT-6293 as duplicate.

@jodygarnett
Copy link
Contributor

The fix for this is being included in GeoTools 22.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants