# Why do single-part WKT polygon vertices require double parentheses?

Regarding the WKT standard: Wikipedia: Well-known text representation of geometry

Why do single-part polygon vertices require double parentheses?

That seems inconsistent with single-part `points` and `linestrings`, which only require one set of parentheses.

• What kind of answer are you looking for? Is "because the standard says so" sufficient? Jun 8, 2022 at 13:42
• @bugmenot123 I guess I'm just checking to see if there's a known reason. It occurred to me that I might be having a brain fart or not understanding something. Maybe there's a legitimate or obvious reason why the double brackets are necessary. Jun 8, 2022 at 13:46
• Impossible to say, but polygon may require two parenthesis if it has a hole just as multilinestring may require two parenthesis if it has many parts. Would it be any easier to think about if you are going to need single or double parenthesis in the beginning and at the end? Jun 8, 2022 at 13:58
• Yes, two parens for polygon to contain optional interior rings `(( {ring1} [),( {ring2}] ))`. Two starting parens is consistent, in that one pair is required for LINESTRING and two pair optional (for multipart), and POLYGON is two parens single, three parens multipart. Jun 8, 2022 at 14:16

It is because polygons can have multiple rings in them, the exterior and a list of interior rings or holes. To save parsers having to guess if there are holes by the number of brackets there are always 2 even if there are no holes.

``````POLYGON((Exterior Ring Coordinates)[(HOLE)....])
``````

@user30184 already gave the short answer in the comments here. For a longer answer, one needs to look to the Simple Feature Access - Part 1: Common Architecture | OGC standard.

The Well-known Text (WKT) representation in the Simple Feature Access (SFA) standard describes how to textually represent an instance of a geometry type, it doesn't define the geometry type itself. The geometry object model is defined earlier in the standard, and the question/issue you have with parentheses is more an outcome of the geometry object model than the WKT representation.

Starting with the geometry object model, 6.1.11 Polygon, Triangle states:

A Polygon is a planar Surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the Polygon.

...

The assertions for Polygons (the rules that define valid Polygons) are as follows:
a) Polygons are topologically closed;
b) The boundary of a Polygon consists of a set of LinearRings that make up its exterior and interior boundaries;

And 6.1.7 LineString, Line, LinearRing states:

A LineString is a Curve with linear interpolation between Points. Each consecutive pair of Points defines a Line segment.

A Line is a LineString with exactly 2 Points.

A LinearRing is a LineString that is both closed and simple

Moving down the standard to 7.2.2 BNF Productions for Two-Dimension Geometry WKT:

``````<linestring tagged text> ::=   linestring <linestring text>
<polygon tagged text> ::=      polygon <polygon text>

...

<linestring text> ::=          <empty set> | <left paren>
<point>
{<comma> <point>}*
<right paren>

<polygon text> ::=             <empty set> | <left paren>
<linestring text>
{<comma> <linestring text>}*
<right paren>
``````

The WKT polygon "double parentheses" inconsistency is actually the opposite, it represents consistency with how WKT linestring is implemented. Just as a WKT linestring is bounded by a single set of parentheses when not empty, so is WKT polygon. The difference is that polygons are comprised of closed and simple linestrings while linestrings are comprised of points. The "extra" set of parentheses isn't coming from the WKT polygon but from the WKT linestrings that make up the WKT polygon.