Can anybody please elaborate on QGIS' topology considering shared vertices of the type depicted in my screen cast?

The polygon in the picture is the same feature, with one node being shared at exactly the same position, without overlapping, leading to an intersection of the line-segments.

I assume this is supposed to be an invalid geometry, however I think it shouldn't.

How to get around this, if I want to retain the position of both vertices??

enter image description here

ps: WKT (sorry for the long one..) https://drive.google.com/open?id=0B2wAunwURQNsc1J4bS15WVBNSmM

  • 2
    Take the WKT of your polygon and paste it into your question.
    – user30184
    Nov 17, 2016 at 11:17
  • @user30184, i linked a txt-file (sorry for the long one..)
    – Kay
    Nov 17, 2016 at 11:26
  • Pay close attention to to topology rules for areal features. You have a multipolygon, not a polygon.
    – Vince
    Nov 17, 2016 at 11:56
  • @Vince, why do you think it is a multipolygon? There is only one outer ring as far as I understand.
    – user30184
    Nov 17, 2016 at 13:24
  • It's multipolygon because it's defined to be so by the topology rules which form the basis of geometry support. There is only one special case where the outer ring can self-intersect (touch at a point), in all other cases, two rings are required to represent the figure you have presented.
    – Vince
    Nov 18, 2016 at 12:32

2 Answers 2


You have ring self-intersection at POINT ( 70349.5 248978.25009999983).

enter image description here

This polygon has a similar error

POLYGON (( 70380 248880, 70380 248920, 70440 248920, 70440 248880, 70400 248880, 70420 248900, 70400 248900, 70400 248880, 70380 248880))

It should be written as a polygon with a hole

POLYGON (( 70380 248920, 70440 248920, 70440 248880, 70400 248880, 70380 248880, 70380 248920 ), ( 70400 248880, 70420 248900, 70400 248900, 70400 248880 ))

Some software do not agree with this interpretion, though. I think that for example Oracle does accept if outer ring is touching itself at one point. However, PostGIS considers it as invalid and this query returns "false"

ST_GeomFromText('POLYGON (( 70380 248880, 70380 248920, 70440 248920, 70440 248880, 70400 248880, 70420 248900, 70400 248900, 70400 248880, 70380 248880))'));

By looking at your geometry, the clean way to correct it is probably to digitize a narrow corridor where the ring is touching itself.

  • No, the "narrow corridor" path leads to madness. It's a multipolygon, and the WKT should reflect it.
    – Vince
    Nov 17, 2016 at 12:24
  • I do not think it is a multipolygon. If the feature was an island in a sea, there is a deep gulf where the error happens. If it should be connected to open sea it should have a connection through a corridor, otherwise the innermost part can be turned into a hole. I tried MakeValid but unfortunately it removes the innermost part of the gulf totally.
    – user30184
    Nov 17, 2016 at 12:34
  • Thx @user30184, the polygon WKT you provided demonstrates exactly what I meant - (OP: "..polygon is one feature") So it is a ring! I also found a QGIS/gdal workaround which I'll post as answer..
    – Kay
    Nov 17, 2016 at 13:17
ogr2ogr input.shp output.shp -dialect sqlite -sql "SELECT ST_Buffer( geometry , 0 ),* FROM 'input'"

...will fix the topology (see How to Identify and Delete duplicate vertices?)! This can be done within QGIS' [OGR] Geoprocessing "Buffer vectors"!

I checked the resulting geometry with the Topology checker - it's well formed! Thanks @user30184 for sorting things out!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.