Hi Uwe,
<br/><br/>This is an email written by Even Rouault from the GDAL dev team. It partially explains the difficulties with deleting geometries in shape files. (Read the last bit about QGIS also). I thought you would like to read it.
<br/><br/>Nicolas
<br/>.....
<br/><br/>Hi,
<br/><br/>There have been some recent discussion on the qgis list about an old ticket
<br/><a href="https://hub.qgis.org/issues/11007" target="_top" rel="nofollow" link="external">https://hub.qgis.org/issues/11007</a><br/><br/>Basically the issue seems to be that a lot / most non-shapelib / non-OGR based
<br/>shapefile readers don't understand the way OGR delete features in shapefiles.
<br/><br/>When OGR/shapelib deletes a feature, it simply marks the corresponding record
<br/>in the DBF as deleted (technically putting a '*' character in the first byte of
<br/>the DBF record) and that's all. Very fast and OGR handles that consistently
<br/>(with the small restriction that the feature count reports the deleted
<br/>features as still existing, but iteration or getting features by id do not
<br/>report them)
<br/><br/>This way of deleting a DBF record is the documented one :
<br/><a href="http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT" target="_top" rel="nofollow" link="external">http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT</a><br/>"""
<br/>Deleted flag:
<br/>Value Description
<br/>2Ah (*) Record is deleted
<br/>20h (blank) Record is valid
<br/>"""
<br/><br/>However other GIS packages, and among others, a famous proprietary one - let's
<br/>call it "LineGIS" - when reading such shapefiles do not recognize the deleted
<br/>feature as deleted and display both the geometry and attributes. More
<br/>annoying, when "LineGIS" deletes another record in such a shapefile and saves
<br/>the result, the shapefile can no longer be opened afterwards with an error
<br/>message reporting an inconsistency in number of shapes w.r.t number of records
<br/>(and on inspection, the shp/shx indeed contain N - 1 records and the dbf N -
<br/>2, so it looks like it would be semi-aware of deleted DBF records)
<br/>When "LineGIS" starts with a "clean" shapefile and deletes a record in it, it
<br/>removes the corresponding entries in the .dbf, .shp and .shx files, which is
<br/>the result of the REPACK operation the shapefile driver can do if explicitly
<br/>asked.
<br/><br/>"LineGIS" isn't the only one to have troubles with deleted DBF records. From
<br/>what I can see GeoTools (just picking a random example) only fully handle them
<br/>since 2014 :
<br/><a href="https://osgeo-org.atlassian.net/browse/GEOT-4539" target="_top" rel="nofollow" link="external">https://osgeo-org.atlassian.net/browse/GEOT-4539</a><br/><a href="https://github.com/geotools/geotools/commit/e7333ccb284d137f3240ce5d0d09b3d7195f1890" target="_top" rel="nofollow" link="external">https://github.com/geotools/geotools/commit/e7333ccb284d137f3240ce5d0d09b3d7195f1890</a><br/><br/>The shapefile specification (
<br/><a href="http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf" target="_top" rel="nofollow" link="external">http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf</a> ) doesn't mention
<br/>about how deleted records should be handled. Particularly if the requirement
<br/>"The table must contain one record per shape feature" (page 25) allows DBF
<br/>records marked as deleted... Anyway the theory/spec and the practice are 2
<br/>different things.
<br/><br/>What surprises me is such an issue didn't raise more loud complaints before as
<br/>the OGR / shapelib behaviour has been the same since forever AFAIK.
<br/><br/>I'm wondering if OGR shouldn't automatically run REPACK when closing a
<br/>shapefile when deletions (as well as edit operations of existing features
<br/>leading to holes in the .shp) have happened. The side effect of this would be a
<br/>slower closing (creation only scenarios wouldn't be affected) and a renumbering
<br/>of the FID of features after the deleted feature(s).
<br/><br/>Thoughts ?
<br/><br/>(Regarding the QGIS issue, as QGIS explicitly runs REPACK after
<br/>edition/deleting, it is not clear why the issue would persist. But some
<br/>reports might be with older QGIS/GDAL versions)
<br/><br/>Even
<br/><br/><br/><br/><br/><br/>Nicolas Cadieux M.Sc.
<br/>Les Entreprises Archéotec inc.
<br/>8548, rue Saint-Denis Montréal H2P 2H2
<br/>Téléphone: 514.381.5112 Fax: 514.381.4995
<br/>www.archeotec.ca
<br/><br/>On Feb 3, 2016 3:29 AM, "Uwe Fischer [via OSGeo.org]" <<a href="/user/SendEmail.jtp?type=node&node=5248691&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:
<div class='shrinkable-quote'><br/>>
<br/>> Spring,
<br/>>
<br/>>
<br/>>
<br/>> it seems to me like there are various errors in editing shapefiles in QGIS 2.10 and 2.12. Some weeks ago, I reported an error that does not allow for proper feature deleting. The shapes I deleted were gone in QGIS, but they were still present in ArcMap.
<br/>>
<br/>>
<br/>>
<br/>> Matthias Kuhn wrote in this context:
<br/>>
<br/>>
<br/>>
<br/>> Hi
<br/>>
<br/>> I just received a confirmation that Marco is working on a fix for this issue and targets the 2.14 release.
<br/>>
<br/>> GDAL 2.0 would still be nice to also have the geometry issue fixed :)
<br/>>
<br/>>
<br/>>
<br/>> Best regards
<br/>>
<br/>> --
<br/>>
<br/>> Matthias Kuhn
<br/>>
<br/>>
<br/>>
<br/>>
<br/>>
<br/>> If it turns out that your problems come from the same origin, maybe it’s time now to disable shapefile editing in QGIS until those problems are solved.
<br/>>
<br/>>
<br/>>
<br/>> Maybe someone more competent than me can give information to the list on the troubleshooting status? QGIS is such an outstanding piece of software, we’d love to see that errors disappear!
<br/>>
<br/>>
<br/>>
<br/>>
<br/>>
<br/>>
<br/>>
<br/>> Mit freundlichen Grüßen,
<br/>>
<br/>>
<br/>>
<br/>> Uwe Fischer
<br/>>
<br/>>
<br/>>
<br/>> Von: Qgis-user [mailto:[hidden email]] Im Auftrag von Springfield Harrison
<br/>> Gesendet: Mittwoch, 3. Februar 2016 07:30
<br/>> An: Nicolas Cadieux <[hidden email]>
<br/>> Cc: qgis-user <[hidden email]>
<br/>> Betreff: Re: [Qgis-user] New Shapefile Features Fail to Save
<br/>>
<br/>>
<br/>>
<br/>> Thanks for those ideas. I can check off most of those items except upgrading. This is new development so likely computer based? Rather than QGIS.
<br/>>
<br/>> I'll look at the bug reports; this is a pretty serious error. Thank you . . . . . .
<br/>>
<br/>> Cheers . . . . . Spring
<br/>> Samsung Tab 4
<br/>>
<br/>> On Feb 2, 2016 7:15 PM, "Nicolas Cadieux" <[hidden email]> wrote:
<br/>>>
<br/>>> Hi,
<br/>>> I have done this in the past without errors in QGIS. I would upgrade to the latest version. Then to figure out where the problem is, I would:
<br/>>>
<br/>>> Make sure that both layer are polygon layers (and not lines and polygons), that both have the same CRS (along with the project CRS), that both have the same fields and that the "receiving layer" is in editing mode, and saved subsequently. I would limited the amount of open files and open plugins.
<br/>>>
<br/>>> Try copying polygons from a newly created file to an empty newly created layer in QGIS and not a shapefile that was previously manipulated in other softwares. All this could help you find the source of the problem.
<br/>>>
<br/>>> I would also look at the bug reports to see if it is an issue for that version.
<br/>>>
<br/>>> Hope this helps.
<br/>>>
<br/>>> Nicolas Cadieux M.Sc.
<br/>>> Les Entreprises Archéotec inc.
<br/>>> 8548, rue Saint-Denis Montréal H2P 2H2
<br/>>> Téléphone: <a href="tel:514.381.5112" target="_blank">514.381.5112 Fax: <a href="tel:514.381.4995" target="_blank">514.381.4995
<br/>>> www.archeotec.ca
<br/>>>
<br/>>> On Feb 2, 2016 8:46 PM, "Springfield Harrison [via OSGeo.org] " <[hidden email]> wrote:
<br/>>>>
<br/>>>> Hello Group,
<br/>>>>
<br/>>>> Am using QGIS 2.10.1 and have done so without significant problems for many months. I am attempting to create simple polygons in a shapefile by direct vertex entry or copying polygons from another shapefile layer and pasting them into the active layer.
<br/>>>>
<br/>>>> In almost every case, these features disappear. There is an entity entry in the attribute table but there are no polygons created. In one case a polygon was created but it was not the shape that I digitized; no more polygons could be created although the process for doing so appears to be working. No error messages were created. The CRS for the project and the shapefile are the same.
<br/>>>>
<br/>>>> The shapefile can be opened in another GIS but has no content.
<br/>>>>
<br/>>>> Here are some product details: QGIS version 2.10.1-Pisa QGIS code revision d20c5b7
<br/>>>>
<br/>>>> Thanks very much for any help you can render, Cheers . . . . . . . . Springfield Harrison
<br/>>>>
<br/>>>> _______________________________________________
<br/>>>> Qgis-user mailing list
<br/>>>> <a href="/user/SendEmail.jtp?type=node&node=5248589&i=0">[hidden email]
<br/>>>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br/>>>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br/>>>>
<br/>>>> ________________________________
<br/>>>>
<br/>>>> If you reply to this email, your message will be added to the discussion below:
<br/>>>>
<br/>>>> <a href="http://osgeo-org.1560.x6.nabble.com/FW-QGIS-crashes-when-using-mouse-wheel-to-zoom-in-and-out-of-WMTS-services-tp5248434p5248589.html" target="_top" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/FW-QGIS-crashes-when-using-mouse-wheel-to-zoom-in-and-out-of-WMTS-services-tp5248434p5248589.html</a><br/>>>>
<br/>>>> To start a new topic under Quantum GIS - User, email [hidden email]
<br/>>>> To unsubscribe from Quantum GIS - User, <a href="<a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==">http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==</a>">click here.
<br/>>>> <a href="<a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml">http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>" style="font:9px serif">NAML
<br/>>>
<br/>>>
<br/>>>
<br/>>> ________________________________
<br/>>>
<br/>>> View this message in context: Re: New Shapefile Features Fail to Save
<br/>>> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
<br/>>>
<br/>>> _______________________________________________
<br/>>> Qgis-user mailing list
<br/>>> [hidden email]
<br/>>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br/>>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br/>>
<br/>>
<br/>> _______________________________________________
<br/>> Qgis-user mailing list
<br/>> [hidden email]
<br/>> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br/>> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_top" rel="nofollow" link="external">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
<br/>>
<br/>> ________________________________
<br/>> If you reply to this email, your message will be added to the discussion below:
<br/>> <a href="http://osgeo-org.1560.x6.nabble.com/FW-QGIS-crashes-when-using-mouse-wheel-to-zoom-in-and-out-of-WMTS-services-tp5248434p5248609.html" target="_top" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/FW-QGIS-crashes-when-using-mouse-wheel-to-zoom-in-and-out-of-WMTS-services-tp5248434p5248609.html</a><br/>> To start a new topic under Quantum GIS - User, email <a href="/user/SendEmail.jtp?type=node&node=5248691&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>
<br/>> To unsubscribe from Quantum GIS - User, click here.
<br/>> NAML</div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/FW-QGIS-crashes-when-using-mouse-wheel-to-zoom-in-and-out-of-WMTS-services-tp5248434p5248691.html">Re: New Shapefile Features Fail to Save</a><br/>
Sent from the <a href="http://osgeo-org.1560.x6.nabble.com/Quantum-GIS-User-f4125267.html">Quantum GIS - User mailing list archive</a> at Nabble.com.<br/>