Bug report #7401

"Add Ring" tool fails with "The inserted Ring is not contained in a feature"

Added by Jeremy Taylor about 11 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16370

Description

I have seen this error a few times. If you map some polygons within QGIS sometimes the add ring tool does not work.
I tried a few things to fix it. Checking the geometry validity, simplifing the polygon, saving out the selection to a new shapefile. All of these failed.
One fix, was to create a brand new shapefile and copy the poly into the new shapefile. Then the add ring tool would work again.

I have the corrupt shapefile attached. If someone can look into what happened to the shapefile and find the link how it was caused by qgis that would be great.

Error.zip (3.32 KB) Jeremy Taylor, 2013-03-19 11:30 PM

Associated revisions

Revision 957d8269
Added by Nyall Dawson over 8 years ago

When adding ring to a geometry, add z or m dimensions to the
ring geometry if required (fix #7400, #7401)

History

#1 Updated by Giovanni Manghi about 11 years ago

  • Subject changed from Add Ring Feature Fails on Mapped Feature using Poly Tool within QGIS to "Add Ring" tool fails with "The inserted Ring is not contained in a feature"
  • OS version deleted (1.8.0)
  • Operating System deleted (Lisboa)
  • Priority changed from Low to Normal
  • Category changed from Vectors to Digitising
  • Affected QGIS version changed from 1.8.0 to master
  • Status info deleted (?)

It fails also on master, the message is

"The inserted Ring is not contained in a feature"

QGIS validation tools says 0 errors.

#2 Updated by Daniel Vaz almost 11 years ago

Hello,

I ran the file command in linux on the attached shapefile and I got it:

Centenary.shp: ESRI Shapefile version 1000 length 2246 type PolygonZ

In the qgsgeometry.cpp:

if ( wkbType() == QGis::WKBPolygon )
  {
    if ( type != GEOS_POLYGON )
      return 1;

    polygonList << mGeos;
  }

was not evaluated to true, because QGis doesn't handle a WKBPolygonZ.

So, I think this issue need more expert coders.

I can fix it with the following code:

mDirtyWkb = true;
exportGeosToWkb();

before the previous piece of code. But it's an ugly HACK.

#3 Updated by Giovanni Manghi almost 11 years ago

The issue seems to be that 3d vectors are not well supported. It is OK if working in copy of the attached vector with the Z infos removed.

#4 Updated by Nyall Dawson over 8 years ago

  • Assignee set to Nyall Dawson

#5 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF