1

I'm new to GIS vector, especially for GIS tools like ArcGIS, QGIS,...

My question is, for this image below with poylgon 1 and polygon 2, typically how a WKT (Well-known text) is represented in GIS tools?

I can see two possible cases, please speak from your experience what case should be used normally by GIS tools (e.g: ArcGIS, QGIS) when I have multiple polygons nested:

  1. By using polygon with interior ring. Is that correct, WKT only supports 1 nested polygon as interior ring?

    POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))

  2. By using multipolygon containing polygons without any rings:

    MULTIPOLYGON ( ((30 20, 45 40, 10 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)) )

enter image description here

4
  • Do you mean that polygon 1 (yellow) has a hole, and polygon 2 (blue) fills that hole? Or is polygon 1 without any holes and polygon 2 overlaps it? If polygon 1 is the yellow stripe that makes a loop just as you draw it, then it is invalid. The two vertices in the interior of the yellow area make a self-intersection.
    – user30184
    Commented Jan 14, 2021 at 9:28
  • @user30184 It can be understood the both ways. My case is it can have multiple polygon are overlapping like in this image and I want to represent it meaningfully by WKT format which GIS tools can understand images.theconversation.com/files/254653/original/… Commented Jan 14, 2021 at 9:32
  • 1
    Please clarify your question about "WKT only supports 1 nested polygon as interior ring". Polygon can have many holes (inner rings). Polygon with a hole that has another polygon inside that hole can be expressed as a multipolygon.
    – user30184
    Commented Jan 14, 2021 at 10:08
  • @user30184 you are right, polygon can have multiple interior rings: postgis.net/workshops/postgis-intro/geometries.html#polygons Commented Jan 14, 2021 at 10:10

1 Answer 1

2

I understood your description that in the first case the blue area is totally overlapping the yellow area and in the second case the yellow area has a hole that is totally filled with the blue area.

If you want to express those cases in WKT as one geometry you must use GeometryCollection.

enter image description here

Case 1:

Big polygon without holes + small polygon

GEOMETRYCOLLECTION (
    POLYGON ((
            642 405, 
            645 407, 
            645 410, 
            649 410, 
            649 406, 
            646 406, 
            643 404, 
            642 405
        )), 
    POLYGON ((
            646 409, 
            648 409, 
            648 407, 
            646 407, 
            646 409
        )))

Case 2:

Big polygon with a hole + small polygon

GEOMETRYCOLLECTION (
    POLYGON ((
            642 405, 
            645 407, 
            645 410, 
            649 410, 
            649 406, 
            646 406, 
            643 404, 
            642 405
        ), (
            646 409, 
            646 407, 
            648 407, 
            648 409, 
            646 409
        )), 
    POLYGON ((
            646 409, 
            648 409, 
            648 407, 
            646 407, 
            646 409
        )))

Geometrycollection is required because parts of a multipolygon can touch only at one point.

2
  • Thanks, I wanted to have a WKT which can be drawn on GIS tools. From what I saw with Google Maps arthur-e.github.io/Wicket/sandbox-gmaps3.html, you could copy this WKT Multipolygon below and paste on the web page to draw. It works fine without " parts of a multipolygon can touch only at one point." MULTIPOLYGON( ((-102.3047 24.2069, -96.8555 66.1605, 40.0781 65.1461, 30.7617 27.6835, -102.3047 24.2069)), ((-83.6719 52.4828, -66.0938 61.6899, -51.8555 48.4584, -66.4453 45.2130, -83.6719 52.4828)), ((-8.2617 49.8380, 7.5586 58.2633, 12.3047 47.0402, -8.2617 49.8380)) ) Commented Jan 14, 2021 at 10:08
  • 1
    That is an invalid multipolygon but if it works for your use case then it is OK. Validation tools would merge the internal parts and return a single part multipolygon (or simplified into one polygon) MULTIPOLYGON ((( -102.3047 24.2069, -96.8555 66.1605, 40.0781 65.1461, 30.7617 27.6835, -102.3047 24.2069 ))).
    – user30184
    Commented Jan 14, 2021 at 10:16

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.