Well-known text is a text markup language for representing vectorgeometry objects. A binary equivalent, known as well-known binary, is used to transfer and store the same information in a more compact form convenient for computer processing but that is not human-readable. The formats were originally defined by the Open Geospatial Consortium and described in their Simple Feature Access. The current standard definition is in the ISO/IEC 13249-3:2016 standard.
Geometric objects
WKT can represent the following distinct geometric objects:
Coordinates for geometries may be 2D, 3D, 4D with an m value that is part of a linear referencing system or 2D with an m value. Three-dimensional geometries are designated by a "Z" after the geometry type and geometries with a linear referencing system have an "M" after the geometry type. Empty geometries that contain no coordinates can be specified by using the symbol EMPTY after the type name. WKT geometries are used throughout OGC specifications and are present in applications that implement these specifications. For example, PostGIS contains functions that can convert geometries to and from a WKT representation, making them human readable. The OGC standard definition requires a polygon to be topologically closed. It also states that if the exterior linear ring of a polygon is defined in a counterclockwise direction it will be seen from the "top". Any interior linear rings should be defined in opposite fashion compared to the exterior ring, in this case, clockwise. The following are some other examples of geometric WKT strings: GEOMETRYCOLLECTION,LINESTRING) POINT ZM POINT M POINT EMPTY MULTIPOLYGON EMPTY TRIANGLE) TIN ), )) POLYHEDRALSURFACE Z ), ), ), ), ), ) )
Well-known binary
Well-known binary representations are typically shown in hexadecimal strings. The first byte indicates the byte order for the data:
Each data type has a unique data structure, such as the number of points or linear rings, followed by coordinates in 64-bit double numbers. For example, the geometry POINT is represented as: 000000000140000000000000004010000000000000, where:
1-byte integer 00 or 0: big endian
4-byte integer 00000001 or 1: POINT
8-byte float 4000000000000000 or 2.0: x-coordinate
8-byte float 4010000000000000 or 4.0: y-coordinate
Format variations
; EWKT and EWKB – Extended Well-Known Text/Binary : A PostGIS-specific format that includes the spatial reference system identifier and up to 4 ordinate values. For example: SRID=4326;POINT to locate a longitude/latitude coordinate using the WGS 84 reference coordinate system. ; AGF Text – Autodesk Geometry Format : An extension to OGC's Standard, to include curved elements; most notably used in MapGuide.
Software support
Database engines
Amazon Redshift since November 21, 2019
Apache Drill supports full range of geospatial queries since version 1.12 as well as reading ESRI Shape files.
Apache Solr enterprise search server since 4.0 through JTS
Elasticsearch distributed, RESTful search and analytics engine since 6.2