Bug report #6925

Eliminate slivers polygon creates wrong output

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

Status:Closed
Priority:Severe/Regression
Assignee:Bernhard Ströbl
Category:Processing/QGIS
Affected QGIS version:master Regression?:
Operating System: Easy fix?:
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:16043

Description

pick the attached shape, then select the polygon with attribute "cat = 36" and try the tool, it will say it can't do the operation.

The shape seems to have no errors, and if imported into postgis then the tool will work as expected.

onequestiononyournewplugin.zip (50 KB) Giovanni Manghi, 2012-12-28 01:46 PM

lixo.zip (212 KB) Giovanni Manghi, 2013-01-17 09:20 AM

result.jpg (47.3 KB) Giovanni Manghi, 2013-01-17 09:20 AM

castqgis.ogg (3.41 MB) Giovanni Manghi, 2013-01-17 09:20 AM

elim.zip - sample data after v.clean tool=break and fTools.eliminate (419 KB) Bernhard Ströbl, 2013-01-22 07:59 AM

Associated revisions

Revision aef3f345
Added by Bernhard Ströbl almost 12 years ago

fix #6925

fTools' eliminate now works if the polygon to merge with has an id of 0

Revision 71580df3
Added by Werner Macho almost 12 years ago

Merge pull request #371 from bstroebl/fix#6925

fix #6925 fTools eliminate now works if the polygon to merge with has an id of 0

History

#1 Updated by Bernhard Ströbl almost 12 years ago

I made a pull request that fixes the case that the polygon to merge with has id=0: https://github.com/qgis/Quantum-GIS/pull/371

#2 Updated by Werner Macho almost 12 years ago

  • Status changed from Open to Closed

#3 Updated by Giovanni Manghi almost 12 years ago

Hi Bernhard,

I just noticed that seems the last fixed caused a pretty bad regression in the tool.

Add the attached sample shape and then make a selection using this expression (or even a simpler one):

("USO_SOLO" = 'LE') OR ("USO_SOLO"='PEDR')OR ("USO_SOLO" = 'LAV') OR ("USO_SOLO"='MATOS') OR ("USO_SOLO"='SEBE_ARV') OR ("USO_SOLO"='ETB') OR ("USO_SOLO"='LA') OR ("USO_SOLO"='LA_GR') OR ("USO_SOLO"='EA') OR ("USO_SOLO"='AUTOESTRADA')

then run the tool.

The result (attached screenshot) is a shape where many polygons where lost, and if you give the vector a little transparency you'll see that a few polygons are now duplicated.

Moreover in the result there are strange "structures" that when edited are revealed as tringular flattened holes (notice that the input layer is topologically correct, it has been checked with GRASS, so such "structures" are really not expected). See attached screencast.

Note:
the tool before the last fix does not produce such missing/duplicated polygons, but also does not produce the right result (with the above selection).

#4 Updated by Giovanni Manghi almost 12 years ago

  • Subject changed from Eliminate slivers polygon tool fail to remove a particular polygon to Eliminate slivers polygon creates wrong output

#5 Updated by Bernhard Ströbl almost 12 years ago

Giovanni,

thanks for thorough testing!
I even get the wrong result when undoing the last fix. So the good message: it is not a regression :-)

#6 Updated by Giovanni Manghi almost 12 years ago

thanks for thorough testing!

you welcome! but this is a so useful tool that it is not easy NOT test it :)

I even get the wrong result when undoing the last fix.

do you mean the missing/duplicated polygon?

I don't, but instead the attributes of the result layer are mixed up, so it is still wrong, but just on the attributes side.

#7 Updated by Bernhard Ströbl almost 12 years ago

Giovanni Manghi wrote:

do you mean the missing/duplicated polygon?

I don't, but instead the attributes of the result layer are mixed up, so it is still wrong, but just on the attributes side.

I mean my result looks the very same using current master and undoing my fix in current master. Are you on current master? Did not check attributes, though.

#8 Updated by Bernhard Ströbl almost 12 years ago

Giovanni,

I redid my code, and issued a pull request containing the changes. Give it a try with your data.
During my analysis I discovered your data are not really topologically correct: Adjacent polygons do not always share the same nodes, some nodes are missing in one of the two polygons. This results in useless line fragments within polygons after running eliminate. I fixed your data by running v.clean tool=break in GRASS.

#9 Updated by Alexander Bruy almost 12 years ago

  • Status changed from Reopened to Closed

#10 Updated by Alexander Bruy almost 12 years ago

  • Resolution set to fixed

#11 Updated by Giovanni Manghi almost 12 years ago

Bernhard Ströbl wrote:

Giovanni,

I redid my code, and issued a pull request containing the changes. Give it a try with your data.
During my analysis I discovered your data are not really topologically correct: Adjacent polygons do not always share the same nodes, some nodes are missing in one of the two polygons. This results in useless line fragments within polygons after running eliminate. I fixed your data by running v.clean tool=break in GRASS.

Thanks!

well... if it wasn't clean (then I missed something when using grass) then the "strange" results are understandable.

After rewriting the tool code does it works with the provided sample? I'm asking just because I'm with of lack of time to test in there days.

cheers!

#12 Updated by Bernhard Ströbl almost 12 years ago

Giovanni Manghi wrote:

well... if it wasn't clean (then I missed something when using grass) then the "strange" results are understandable.

No, the strange results (holes and overlaps) where caused by the code. I have described all that was caused by the data not being clean in message 8 above

Giovanni Manghi wrote:

After rewriting the tool code does it works with the provided sample? I'm asking just because I'm with of lack of time to test in there days.

It worked with the sample data. I attached the resulting shape file.

#13 Updated by Giovanni Manghi over 7 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

Also available in: Atom PDF