Well-known text (WKT)

Well-Known Text (WKT) is an ASCII representation of a spatial object.

Well-Known Text (WKT) is an ASCII representation of a spatial object.

WKTs are not case sensitive; Vertica recognizes any combination of lowercase and uppercase letters.

Some examples of valid WKTs are:

WKT Example Description
POINT(1 2) The point (1,2)
MULTIPOINT(0 0,1 1) A set made up of the points (0,0) and (1,1)
LINESTRING(1.5 2.45,3.21 4) The line from the point (1.5,2.45) to the point (3.21,4)
MULTILINESTRING((0 0,–1 –2,–3 –4),(2 3,3 4,6 7)) Two linestrings, one that passes through (0,0), (–1,–2), and (–3,–4), and one that passes through (2,3), (3,4), and (6,7).
POLYGON((1 2,1 4,3 4,3 2,1 2)) The rectangle whose four corners are indicated by (1,2), (1,4), (3,4), and (3,2). A polygon must be closed, so the first and last points in the WKT must match.
POLYGON((0.5 0.5,5 0,5 5,0 5,0.5 0.5), (1.5 1,4 3,4 1,1.5 1)) A polygon (0.5 0.5,5 0,5 5,0 5,0.5 0.5) with a hole in it (1.5 1,4 3,4 1,1.5 1).
MULTIPOLYGON(((0 1,3 0,4 3,0 4,0 1)), ((3 4,6 3,5 5,3 4)), ((0 0,–1 –2,–3 –2,–2 –1,0 0))) A set of three polygons
GEOMETRYCOLLECTION(POINT(5 8), LINESTRING(–1 3,1 4)) A set containing the point (5,8) and the line from (–1,3) to (1,4)

POINT EMPTY

MULTIPOINT EMPTY

LINESTRING EMPTY

MULTILINESTRING EMPTY

MULTILINESTRING(EMPTY)

POLYGON EMPTY

POLYGON(EMPTY)

MULTIPOLYGON EMPTY

MULTIPOLYGON(EMPTY)

Empty spatial objects; empty objects have no points.

Invalid WKTs are:

  • POINT(1 NAN), POINT(1 INF)—Coordinates must be numbers.

  • POLYGON((1 2, 1 4, 3 4, 3 2))—A polygon must be closed.

  • POLYGON((1 4, 2 4))—A linestring is not a valid polygon.