qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

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

Closed qgib closed 5 years ago

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman) Original Redmine Issue: 5824 Affected QGIS version: master Redmine category:digitising


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).



Related issue(s): #14913 (relates), #15358 (duplicates) Redmine related issue(s): 5161, 5917


qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 12 years ago

Author Name: Salvatore Larosa (@slarosa)


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?

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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.

qgib commented 12 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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.

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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.

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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.

qgib commented 12 years ago

Author Name: Salvatore Larosa (@slarosa)


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?

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


yes, the issue is #15161

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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

qgib commented 12 years ago

Author Name: Jürgen Fischer (@jef-n)


Giovanni Manghi wrote:

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

no, see #14913

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


see also #15358

qgib commented 12 years ago

Author Name: Giovanni Manghi (@gioman)


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.