> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Well Known Text

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The Well Known Text format (hereafter *WKT*) provides a text representation of a geometric shape. It can be used to:

* Build instances of various shapes (e.g., using `ST_MakePolygon` on a Linestring).
* Convert existing shapes to a text representation for ease of reading.

Each shape in WKT has a *tag* which says what it is, usually followed by a list of coordinates. For example, here are some common tags:

* `POINT(...)`
* `LINESTRING(...)`
* `POLYGON((...))`

WKT is technically case insensitive, but is sometimes displayed using "CamelCase" for easier reading. For example, one can represent a MultiPolygon as either of:

* `MULTIPOLYGON(...)`
* `MultiPolygon(...)`

When a shape is made up of homogeneous subcomponents, such as a polygon made up of various points, the subcomponents do not need to have their own tags. For example:

`LINESTRING(-88.243385 40.116421, -87.906471 43.038902, -95.992775 36.153980)`

Shapes expressed in WKT can have an <InternalLink path="architecture/glossary">SRID</InternalLink> prepended to the shape and followed by a semicolon, in the form `SRID=123;TAG(...)`. The format is known as Extended Well Known Text (*EWKT*); it is the same as WKT, with an <InternalLink path="architecture/glossary#srid">SRID</InternalLink> representation prepended to the data structure.

For example, below is a polygon representing a geometry that uses <InternalLink path="srid-4326">SRID 4326</InternalLink>, which is used to represent latitude and longitude coordinates on the Earth as defined in the <InternalLink path="architecture/glossary#wgs84">WGS84</InternalLink> standard:

`SRID=4326;POLYGON((-87.906471 43.038902, -95.992775 36.153980, -75.704722 36.076944, -87.906471 43.038902))`

For more detailed information about the Well Known Text format, see [the OGC specification for
WKT](http://docs.opengeospatial.org/is/18-010r7/18-010r7).

<Note>
  CockroachDB only supports 2-dimensional geometries.
</Note>

## See also

* <InternalLink path="spatial-data-overview">Spatial Data Overview</InternalLink>
* <InternalLink path="spatial-indexes">Spatial indexes</InternalLink>
* <InternalLink path="architecture/glossary">Spatial and GIS Glossary of Terms</InternalLink>
* [Geographic information — Well-known text representation of coordinate reference systems](http://www.opengis.net/doc/is/wkt-crs/2.0.6)
* [OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture](https://portal.opengeospatial.org/files?artifact_id=25355)
* <InternalLink path="well-known-binary">Well known binary</InternalLink>
* <InternalLink path="geojson">GeoJSON</InternalLink>
* <InternalLink path="srid-4326">SRID 4326 - longitude and latitude</InternalLink>
* [Introducing Distributed Spatial Data in CockroachDB](https://www.cockroachlabs.com/blog/spatial-data/) (blog post)
