RemoveAt does not remove Attributes


When a featureset is in index mode and RemoveFeaturesAt is called it eventually gets to

public void RemoveShapesAt(IEnumerable<int> indices)
        foreach (int index in remove)
            if (AttributesPopulated)

But AttributesPopulated is false. so the data table is not maintained correctly.

Shapes are deleted but the corresponding rows are not.

Now call FeatureSet.Save and you will have a file where there are more data rows than shapes.
Closed Feb 28 at 8:04 AM by jany_
This issue list is no longer active. This issue has been copied to our issue list on github (https://github.com/DotSpatial/DotSpatial/issues)

Please check there to find out whether this issue was fixed.


Shade1974 wrote Dec 1, 2010 at 4:56 AM

Currently this is just a flag, rather than running an internal test. Do you think we should make the Attributes loaded property do a verification on the DataTable internally? We can't just test DataTable == null because that reference itself will try to load the data in a lazy fashion when needed. But we could test it internally, and as a bonus ensure that the number of rows in the DataTable is the same as the number of shapes. To quick fix your problem, it sounds like you can just set the AttributesLoaded flag to true. How are you getting the attributes into the dataset? If you are loading from a shapefile and the value is not being set we need to fix it. If you are adding the rows manually, then maybe just setting the property to true will solve the problem for now.