Bug report #5824

QGIS silently fails to add a geometry using "avoid intersection" on a polygon that passes geometry validation

Added by Giovanni Manghi over 7 years ago. Updated almost 7 years ago.

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

Description

Add the attached polygon. It has obviously something weird/wrong, nevertheless both the node tool and the "check geometry" tools do not return any error.

Then try digitise a new polygon adjacent to the existing one, using the "avoid intersection" feature: QGIS will silently fail to add the new geometry, while the attribute is recorded in the table of attributes.

If a warning will be issued then QGIS must also recognise the geometry problem (as it happens with self intersections).

bad_good_polygon_shp.zip (2.85 KB) Giovanni Manghi, 2012-06-18 06:13 PM


Related issues

Related to QGIS Application - Bug report #5161: Updating GEOS library to 3.3 on OSGeo4w Closed 2012-03-12
Duplicated by QGIS Application - Bug report #5917: QGIS crashes when digitizing vector sets Closed 2012-06-30

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Subject changed from QGIS silently fails to add a geometry using "avoid interection" on a polygon that passes gemoetry validation to QGIS silently fails to add a geometry using "avoid interection" on a polygon that passes geometry validation

#2 Updated by Salvatore Larosa over 7 years ago

it seems not be a valid geometry, isGeosValid() returns False!

May be this the problem? or
avoid intersection option doesn't work with invalid geometry?

#3 Updated by Giovanni Manghi over 7 years ago

Salvatore Larosa wrote:

it seems not be a valid geometry, isGeosValid() returns False!

May be this the problem? or
avoid intersection option doesn't work with invalid geometry?

yes it is clearly invalid even without using GEOS. The problem is that QGIS validates the geometry (and the common user uses QGIS not GEOS :) ), but then silently fail to work.

#4 Updated by Jürgen Fischer over 7 years ago

  • Subject changed from QGIS silently fails to add a geometry using "avoid interection" on a polygon that passes geometry validation to QGIS silently fails to add a geometry using "avoid intersection" on a polygon that passes geometry validation

#5 Updated by Giovanni Manghi over 7 years ago

by the way:

in the attached polygon there are what seems to be two "segments" that are the cause of the problem (for example zoom in the right bottom corner of the polygon): it seems to me there is no way with the node tool to get rid of such anomalies.

#6 Updated by Giovanni Manghi over 7 years ago

well, changing the validation method to geos the error obviously is shown. I still can't see an easy way to get rid of such "segments", that in truth are flattened polygons with 3 vertices.

#7 Updated by Giovanni Manghi over 7 years ago

Giovanni Manghi wrote:

I still can't see an easy way to get rid of such "segments", that in truth are flattened polygons with 3 vertices.

of course... the "delete part" tool... I need a coffee.

#8 Updated by Salvatore Larosa over 7 years ago

Giovanni Manghi wrote:

The problem is that QGIS validates the geometry (and the common user uses QGIS not GEOS :) ), but then silently fail to work.

Do you mean that "QGIS validates the layer"??

Anyway, if I create a new geometry (with enabled avoid intersection option) and saves I get segfault:

Program received signal SIGSEGV, Segmentation fault.
OGRGeometryFactory::createFromWkb (pabyData=0x0, poSR=0x0, ppoReturn=0x7fffffffb538, nBytes=173)
    at ogrgeometryfactory.cpp:75
75    OGRErr OGRGeometryFactory::createFromWkb(unsigned char *pabyData,
(gdb) bt
#0  OGRGeometryFactory::createFromWkb (pabyData=0x0, poSR=0x0, ppoReturn=0x7fffffffb538, 
    nBytes=173) at ogrgeometryfactory.cpp:75
#1  0x00007fffd5e7e38b in QgsOgrProvider::addFeature (this=0x53a6630, f=...)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/providers/ogr/qgsogrprovider.cpp:1006
#2  0x00007fffd5e7eefc in QgsOgrProvider::addFeatures (this=0x53a6630, flist=...)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/providers/ogr/qgsogrprovider.cpp:1084
#3  0x00007ffff4bec7b4 in QgsVectorLayer::commitChanges (this=0x53edf70)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/core/qgsvectorlayer.cpp:3876
#4  0x000000000056b7e5 in QgisApp::toggleEditing (this=0xe9c9b0, layer=0x53edf70, allowCancel=true)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/app/qgisapp.cpp:4755
#5  0x000000000056ac9c in QgisApp::toggleEditing (this=0xe9c9b0)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/app/qgisapp.cpp:4635
#6  0x00000000007daac6 in QgisApp::qt_static_metacall (_o=0xe9c9b0, 
    _c=QMetaObject::InvokeMetaMethod, _id=153, _a=0x7fffffffc3a0)
    at /home/sam/pacchetti_gis/Quantum-GIS/build-master/src/app/moc_qgisapp.cxx:565
#7  0x00007ffff3408591 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007ffff2770d52 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#9  0x00007ffff2770f3f in QAction::activate(QAction::ActionEvent) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007ffff2b4296a in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007ffff2b42c1c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007ffff2c001da in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff27c7964 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007ffff2777204 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007ffff277c953 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff4ae6bb0 in QgsApplication::notify (this=0x7fffffffdb10, receiver=0xed4480, event=
    0x7fffffffcd20) at /home/sam/pacchetti_gis/Quantum-GIS/src/core/qgsapplication.cpp:222
#17 0x00007ffff33f41ac in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#18 0x00007ffff27781d2 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007ffff27f4635 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff27f34fa in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007ffff281be62 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#22 0x00007fffef42c205 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007fffef42c538 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fffef42c5f4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff34236cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#26 0x00007ffff281baee in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#27 0x00007ffff33f2f92 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#28 0x00007ffff33f31e7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007ffff33f8277 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x0000000000547405 in main (argc=1, argv=0x7fffffffe3b8)
    at /home/sam/pacchetti_gis/Quantum-GIS/src/app/main.cpp:792
(gdb) 

happens to you?

#9 Updated by Giovanni Manghi over 7 years ago

yes, the issue is #5584

#10 Updated by Giovanni Manghi about 7 years ago

I cannot see the "GEOS" option in "Validation Method" under Windows/OSGeo4W, am I missing a package?

#11 Updated by Jürgen Fischer about 7 years ago

Giovanni Manghi wrote:

I cannot see the "GEOS" option in "Validation Method" under Windows/OSGeo4W, am I missing a package?

no, see #5161

#12 Updated by Giovanni Manghi about 7 years ago

see also #5917

#13 Updated by Giovanni Manghi almost 7 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Something changed, I guess for the better as now with master, with the above steps, QGIS always add the new polygon. I'll tag this as fixed, but I would appreciate if someone can test also on Windows, as in these days I cannot access my VM.

Also available in: Atom PDF