Bug report #8174

Polygons digitized in Postgis layer with "Avoid Intersections" turned on still overlap their neighbors

Added by Tu Cao almost 11 years ago. Updated about 10 years ago.

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

Description

I check with ST_Overlaps on Postgis layer after digitizing each polygon and the frequency this problem happens (number of polygons from a clean layer to the first one that overlap others): 4, 7, 6, 15, 7
My test system:
Client: Qgis 1.8 on Debian 7 64 bit
Server: Postgis 2.0 on PosgreSQL 9.2, Ubuntu 12.04 64 bit

Other clients I tried and have the same problem: Windows Qgis 1.8 Standalone Installer, QGIS-OSGeo4W-1.9.0-25-Setup.exe

My asking for help on this problem: http://lists.osgeo.org/pipermail/qgis-user/2013-June/022847.html

qgis-bug-1.png (141 KB) George Rodrigues da Cunha Silva, 2013-08-09 07:36 AM

qgis-bug-2.png (139 KB) George Rodrigues da Cunha Silva, 2013-08-09 07:36 AM

qgis-bug-3.png (148 KB) George Rodrigues da Cunha Silva, 2013-08-09 07:36 AM


Related issues

Related to QGIS Application - Bug report #2921: Avoid intersection of new polygons.. IS BROKEN Closed
Related to QGIS Application - Bug report #9013: When digitizing with "avoid intersections" layer type sho... Closed 2013-11-06
Related to QGIS Application - Bug report #9014: QGis avoid intersection options is creating sliver polygons Closed 2013-11-06
Related to QGIS Application - Bug report #4880: "add feature" tool (for polygons) + "avoid intersection" ... Closed 2012-01-25

Associated revisions

Revision caf33b65
Added by Martin Dobias about 10 years ago

Fix #8174 (overlaps when using 'avoid intersections' functionality) + test

I am not entirely confident if it will work perfectly with older versions of GEOS (< 3.3)
because of the lack of unary union (that is emulated by series of unions of two geometries)

History

#1 Updated by Giovanni Manghi almost 11 years ago

  • Category set to Digitising
  • Status changed from Open to Feedback
  • Affected QGIS version changed from master to 1.8.0

Can you try on QGIS master and report back? Thanks!

#2 Updated by Tu Cao almost 11 years ago

I've just tried on Master on my Debian 7 PC, the bug's still there.

#3 Updated by Giovanni Manghi almost 11 years ago

  • Affected QGIS version changed from 1.8.0 to master

#4 Updated by Giovanni Manghi almost 11 years ago

  • Priority changed from High to Severe/Regression
  • Status changed from Feedback to Open
  • Target version set to Version 2.0.0

I can confirm this pretty serious error. I have attached a screencast to show on how easy is to replicate this issue.

https://www.dropbox.com/s/6elzwbwxcml1sck/postgis_editing_error.mp4

Basically:
  • start editing a multiploygon layer with the "avoid intersection" option enabled
  • create a few adjacent polygons
  • save edits and check with postgis if you have any overlapping geometry, ex:
select *
from d1 as a
     inner join
     d1 as b
     on st_overlaps(a.geom, b.geom)
where a.id_0 < b.id_0
  • go and see one of the offending geometries using the identify tool
  • you will see that there are parts that were supposed to be removed by the "avoid intersection" option

You can see this issue also when editing a polygon layer, if you use the above steps you will end with a


Provider errors:
PostGIS error while adding features: ERROR: Geometry type (MultiPolygon) does not match column type (Polygon)

even if you are supposed to not create multipolygon geomeytries.

I'll tag this as blocker because I don't recall seeing this issue in previous qgis releases. Even if not a real regression this bug is so nasty that I would suggest fix it anyway before 2.0

See also http://gis.stackexchange.com/questions/64177/why-postgis-st-overlaps-reports-qgis-avoid-intersections-generated-polygon-as

#5 Updated by George Rodrigues da Cunha Silva over 10 years ago

Hi Giovanni,

I can reproduce your bug with Quantum GIS 1.8 and Postgis 2.0 on Windows and Linux (ubuntu 13.04 and windows 7).

I'm not sure, but there is a catch here. I've watched your video and noticed that you did not specified a snapping tolerance.

I did some tests and QGis behaves nicely when there is a tolerance set (> 0, for instance. I'm testing with 15 pixels). Without tolerance, occurs the problem.

select *
from solo as a
inner join
solo as b
on st_overlaps(a.geometria, b.geometria)
where a.id < b.id

This query above gives me zero errors.

I've tried it further with 0 tolerance, and it worked too, but I got a fail, that I could not register a screenshot.

EDIT:

This bug seems intermittent, sometimes it fails.

#6 Updated by Giovanni Manghi over 10 years ago

Olá George

I can reproduce your bug with Quantum GIS 1.8 and Postgis 2.0 on Windows and Linux (ubuntu 13.04 and windows 7).

I'm not sure, but there is a catch here. I've watched your video and noticed that you did not specified a snapping tolerance.

I did some tests and QGis behaves nicely when there is a tolerance set (> 0, for instance. I'm testing with 15 pixels). Without tolerance, occurs the problem.

i just tested again and I'm able to always replicate the issue also with some snapping tolerance active.

Anyway I would expect the "avoid intersection" option to do right what advertises even without snapping defined :)

abraços!

#7 Updated by Giovanni Manghi over 10 years ago

The workaround that should be implemented #2921-23 does not seems to work.

#8 Updated by Giovanni Manghi over 10 years ago

I don't see anyone fixing this before the 2.0 release, I don't anyway understand how this issue does not raise more attention as it is really a bad bad one.

#9 Updated by Pedro Venâncio over 10 years ago

I agree with Giovanni, it would be important to have this problem solved to 2.0.

#10 Updated by Sandro Santilli over 10 years ago

I see crashers not marked as "blockers", I think they should take precedence over this one.

#11 Updated by Giovanni Manghi over 10 years ago

Sandro Santilli wrote:

I see crashers not marked as "blockers", I think they should take precedence over this one.

a blocker, as decided in Lyon, is a regression. A crasher is "high".

This should not be a blocker... as it not a regression.

it is anyway a issue so bad that should be treated like one :)

#12 Updated by Giovanni Manghi over 10 years ago

it is anyway a issue so bad that should be treated like one :)

if it is a qgis issue, of course.

#13 Updated by Giovanni Manghi over 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - High Priority

#14 Updated by Giovanni Manghi over 10 years ago

see also #9014

#15 Updated by George Rodrigues da Cunha Silva over 10 years ago

Hello guys,

In the lack of a better fix (it seems the problem is in GEOS itself, not in QGis), I would suggest that we implement a different solution for this, something along the lines of this suggestion: #9013

We have a few options:

  • If the ideas in #9013 (for single-part polygon layers, avoid intersections should create n features instead of a multipolygon) are implemented, we can just delete the sliver polygons easily, checking them out by area.
  • After the feature creation and before it goes to the datasource, we look for sliver polygons and remove them (perhaps via Python action?);

Is that something it can be done easily?

We are desperate for a solution and I really do NOT want to stop using QGis, as my next best option would be ArcGIS.

#16 Updated by Giovanni Manghi over 10 years ago

We are desperate for a solution and I really do NOT want to stop using QGis, as my next best option would be ArcGIS.

please raise this important issue in the Developers and/or users mailing list. I have already tried to do so weeks ago.

#17 Updated by Sandro Santilli over 10 years ago

What about changing the algorithm avoiding the recursive intersection approach ? You could extract all the linework of polygons involved in the "avoid intersection" process, fully node the linework, polygonize the noded linework and finally re-assign polygons to new or pre-existing features. Does it sound as a possible solution ?

#18 Updated by George Rodrigues da Cunha Silva over 10 years ago

For it seems doable, but I'm not a C++ dev.

Our company is willing to fund a fix for this issue, but so far we have no other suggestions or workarounds.

#19 Updated by Giovanni Manghi over 10 years ago

George Rodrigues da Cunha Silva wrote:

For it seems doable, but I'm not a C++ dev.

Our company is willing to fund a fix for this issue, but so far we have no other suggestions or workarounds.

Olá George,
please contact directly one of the (many) companies that offers commercial support

http://qgis.org/en/site/forusers/commercial_support.html#qgis-commercial-support

cheers!

#20 Updated by Martin Dobias about 10 years ago

  • Status changed from Open to Closed

#21 Updated by Sandro Santilli about 10 years ago

Is this duplicate of #2921 ?

#22 Updated by Giovanni Manghi about 10 years ago

  • Resolution set to fixed/implemented

Sandro Santilli wrote:

Is this duplicate of #2921 ?

yes, closed that too.

Also available in: Atom PDF