Deleting a feature from a ShapefileFeatureTable only marks the record for deletion in .dbf file

257
5
04-28-2021 06:00 AM
zjoerg
by
New Contributor II

It seems that the following code does not delete the record in the .dbf file. Instead it is only marked for deletion:

await shapefileFeatureTable.DeleteFeatureAsync(feature);
shapefileFeatureTable.Close();

If you load the shapefile in ArcMap afterwards you'll get this warning message:
There was a problem drawing the shapefile. Drawing aborted.
If you look into the table you will still see the feature which was deleted in the ArcGIS Runtime app (there it isn't displayed anymore). I think what is missing is a kind of pack function call for the .dbf file during the closing of the ShapefileFeatureTable.

I found this behaviour in Version 100.9 (WPF) but I think it might have existed in the versions before. I also tested it in Version 100.11 (WPF) with the same result.

5 Replies
DanPatterson
MVP Honored Contributor

Deleting records from a shapefile table will cause errors, you have to delete the feature itself, then the record will be deleted from the table.  This can be confirmed by trying it manually in either arcmap or arcgis pro


... sort of retired...
0 Kudos
zjoerg
by
New Contributor II

Thanks for your quick response.
Perhaps I'm missing something but I think in the ArcGIS Runtime SDK you can only delete a feature via its feature table. At least I did not find a Delete method or something like that on the class 'Feature'.

0 Kudos
TonyWakim
Esri Contributor

Does Runtime have any issues with the deleted feature, or does it seem to work as expected?

 

 

0 Kudos
zjoerg
by
New Contributor II

In my ArcGIS Runtime app the shapefile works as expected even after deleting a feature.

I'm already in touch with the ESRI support about this case and they digged up a bug report for the ArcGIS Runtime Android SDK: BUG-000117942

It's very likely that I stumbled across the same issue in the ArcGIS Runtime SDK for .NET.

0 Kudos
TonyWakim
Esri Contributor

Thanks for the info @zjoerg.  I was able to reproduce with ArcGIS Runtime .Net 100.11 as well. It does seem to be the same issue identified in the the ArcGIS Runtime Android SDK: BUG-000117942.

0 Kudos