Submitted Successfully!
To reward your contribution, here is a gift for you: A free trial for our video production service.
Thank you for your contribution! You can also upload a video entry or images related to this topic.
Version Summary Created by Modification Content Size Created at Operation
1 handwiki -- 1285 2022-10-27 01:49:51

Video Upload Options

We provide professional Video Production Services to translate complex research into visually appealing presentations. Would you like to try it?

Confirm

Are you sure to Delete?
Cite
If you have any further questions, please contact Encyclopedia Editorial Office.
HandWiki. Well-Known Text. Encyclopedia. Available online: https://encyclopedia.pub/entry/31572 (accessed on 27 December 2024).
HandWiki. Well-Known Text. Encyclopedia. Available at: https://encyclopedia.pub/entry/31572. Accessed December 27, 2024.
HandWiki. "Well-Known Text" Encyclopedia, https://encyclopedia.pub/entry/31572 (accessed December 27, 2024).
HandWiki. (2022, October 27). Well-Known Text. In Encyclopedia. https://encyclopedia.pub/entry/31572
HandWiki. "Well-Known Text." Encyclopedia. Web. 27 October, 2022.
Well-Known Text
Edit

Well-known text (WKT) is a text markup language for representing vector geometry objects on a map, spatial reference systems of spatial objects and transformations between spatial reference systems. A binary equivalent, known as well-known binary (WKB), is used to transfer and store the same information on databases. The formats were originally defined by the Open Geospatial Consortium (OGC) and described in their Simple Feature Access and Coordinate Transformation Service specifications. The current standard definition is in the ISO/IEC 13249-3:2016 standard, "Information technology – Database languages – SQL multimedia and application packages – Part 3: Spatial" (SQL/MM) and ISO 19162:2015, "Geographic information – Well-known text representation of coordinate reference systems".

geospatial spatial reference vector geometry

1. Geometric Objects

WKT can represent the following distinct geometric objects:

  • Geometry
  • Point, MultiPoint
  • LineString, MultiLineString
  • Polygon, MultiPolygon, Triangle
  • CircularString
  • Curve, MultiCurve, CompoundCurve
  • CurvePolygon
  • Surface, MultiSurface, PolyhedralSurface
  • TIN (Triangulated irregular network)
  • GeometryCollection

Coordinates for geometries may be 2D (x, y), 3D (x, y, z), 4D (x, y, z, m) with an m value that is part of a linear referencing system or 2D with an m value (x, y, m). 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.

It's useful to note that 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 counter clockwise 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.[1]

Geometry primitives (2D)

Multipart geometries (2D)

The following are some other examples of geometric WKT strings: (Note: Each item below is an individual geometry.)

GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10)) POINT ZM (1 1 5 60) POINT M (1 1 80) POINT EMPTY MULTIPOLYGON EMPTY CIRCULARSTRING(1 5, 6 2, 7 3) COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1)) CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)) MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2)) TRIANGLE((0 0 0,0 1 0,1 1 0,0 0 0)) TIN (((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0))) POLYHEDRALSURFACE Z ( PATCHES ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)), ((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)), ((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)) )

1.1. Well-Known Binary

Well-known binary (WKB) representations are typically shown in hexadecimal strings.

The first byte indicates the byte order for the data:

  • 00 : big endian
  • 01 : little endian

The next 4 bytes are a 32-bit unsigned integer for the geometry type, as described below:

Geometry types, and WKB integer codes
Type 2D Z M ZM
Geometry 0000 1000 2000 3000
Point 0001 1001 2001 3001
LineString 0002 1002 2002 3002
Polygon 0003 1003 2003 3003
MultiPoint 0004 1004 2004 3004
MultiLineString 0005 1005 2005 3005
MultiPolygon 0006 1006 2006 3006
GeometryCollection 0007 1007 2007 3007
CircularString 0008 1008 2008 3008
CompoundCurve 0009 1009 2009 3009
CurvePolygon 0010 1010 2010 3010
MultiCurve 0011 1011 2011 3011
MultiSurface 0012 1012 2012 3012
Curve 0013 1013 2013 3013
Surface 0014 1014 2014 3014
PolyhedralSurface 0015 1015 2015 3015
TIN 0016 1016 2016 3016
Triangle 0017 1017 2017 3017
Circle 0018 1018 2018 3018
GeodesicString 0019 1019 2019 3019
EllipticalCurve 0020 1020 2020 3020
NurbsCurve 0021 1021 2021 3021
Clothoid 0022 1022 2022 3022
SpiralCurve 0023 1023 2023 3023
CompoundSurface 0024 1024 2024 3024
BrepSolid   1025    
AffinePlacement 102 1102    

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(2.0 4.0) is represented as: 000000000140000000000000004010000000000000, where:

  • 1-byte integer 00 or 0: big endian
  • 4-byte integer 00000001 or 1: POINT (2D)
  • 8-byte float 4000000000000000 or 2.0: x-coordinate
  • 8-byte float 4010000000000000 or 4.0: y-coordinate

2. Coordinate Reference Systems

WKT can describe coordinate reference systems. This WKT format was initially defined by the Open Geospatial Consortium in 1999, then extended in 2001. This format is sometime known as "WKT 1".[2] Later, evolution of the Coordinate Reference System conceptual model, new requirements and inconsistencies in implementation of WKT 1 format between different software[3] have encouraged the revision of that format. The updated "Well-known text representation of coordinate reference systems" standard, sometime known as "WKT 2", was adopted by the Open Geospatial Consortium in 2015.[4] This standard is published conjointly by the International Organization for Standardization as ISO 19162:2015.[5]

For example, the WKT below describes a two-dimensional geographic coordinate reference system with a latitude axis first, then a longitude axis. The coordinate system is related to Earth by the WGS84 geodetic datum:

GEODCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84", 6378137, 298.257223563, LENGTHUNIT["metre", 1]]], CS[ellipsoidal, 2], AXIS["Latitude (lat)“, north, ORDER[1]], AXIS["Longitude (lon)“, east, ORDER[2]], ANGLEUNIT[”degree", 0.0174532925199433]]

The WKT format can describe not only geographic coordinate reference systems, but also geocentric, projected, vertical, temporal and engineering ones (for example a coordinate reference system attached to a boat). The standard describes how to combine those coordinate reference systems together.

2.1. Backward Compatibility

A software capable to read coordinate reference systems in WKT 2 format can also read many (but not all) equivalent systems in WKT 1 format.[6] Some caveats exist, notably the removal of the TOWGS84 element [7] which is replaced by the BOUNDCRS element. Another caveat is about the units of measurement. Some of them were unspecified in oldest WKT 1 specifications (for example the PRIMEM unit), which has led to different interpretations by different software. Those units of measurement have been clarified in the 2001 update and the WKT 2 specification is consistent with that clarification. But not all software have followed the 2001 clarification.

3. Coordinate Operations

A WKT format is defined to describe the operation methods and parameters used to convert or transform coordinates between two different coordinate reference systems. The WKT 1 and WKT 2 formats are incompatible regarding coordinate operations, because of differences in the modelling.[8] Below is an example of a concatenation of two WKT 1 transformation descriptions, where the Mercator projection is applied first and then an affine transform is applied on the result:

CONCAT_MT[ PARAM_MT["Mercator_2SP", PARAMETER["semi_major",6370997.0], PARAMETER["semi_minor",6370997.0], PARAMETER["central_meridian",180.0], PARAMETER["false_easting",-500000.0], PARAMETER["false_northing",-1000000.0], PARAMETER["standard parallel 1",60.0]], PARAM_MT["Affine", PARAMETER["num_row",3], PARAMETER["num_col",3], PARAMETER["elt_0_1",1], PARAMETER["elt_0_2",2], PARAMETER["elt 1 2",3]]]

Below is an example of a datum shift operation in WKT 2 format. Contrarily to an equivalent description in WKT 1 format, the WKT 2 description specifies the source and target coordinate reference systems, together with the domain of validity and the accuracy (in metres) that we can expect from this operation:

COORDINATEOPERATION["AGD84 to GDA94 Auslig 5m", SOURCECRS[…full CRS definition required here but omitted for brevity…], TARGETCRS[…full CRS definition required here but omitted for brevity…], METHOD["Geocentric translations", ID["EPSG", 1031]], PARAMETER["X-axis translation", -128.5, LENGTHUNIT["metre", 1]], PARAMETER["Y-axis translation", -53.0, LENGTHUNIT["metre", 1]], PARAMETER["Z-axis translation", 153.4, LENGTHUNIT["metre", 1]] OPERATIONACCURACY[5], AREA["Australia onshore"], BBOX[-43.7, 112.85, -9.87, 153.68]]

4. Database Engines That Provide Support

  • Apache Solr enterprise search server since 4.0[9] through JTS
  • Elasticsearch distributed, RESTful search and analytics engine since 6.2[10]
  • PostgreSQL with PostGIS Module 2.0
  • Kinetica GPU-accelerated geospatial database
  • Oracle Spatial 9i, 10g, 11g
  • MapD since 4.0
  • MarkLogic Server since 4.2[11]
  • MemSQL since 4[12]
  • MySQL since 4.1[13]
  • MariaDB, all versions
  • Neo4j[14]
  • IBM DB2 LUW 9, 10 with Spatial Extender
  • IBM DB2 for z/OS 9, 10 with Spatial Support
  • IBM Netezza with Netezza Spatial
  • IBM Informix 9,10,11 with Spatial datablade module
  • Microsoft SQL Server 2008 R2, 2012, 2014, 2016
  • SpatiaLite
  • Teradata 6.1, 6.2, 12, 13 (native in 13 through add-in in previous versions)
  • Ingres GeoSpatial
  • Altibase 5.x
  • SQL Anywhere 12
  • SAP HANA SP07,SP08
  • H2 since 1.3.173 (2013-07-28)[15]
  • Vertica since 7.1.0[16]
  • VoltDB since V6.0[17]

5. APIs That Provide Support

  • Apache Spatial Information System: parses and formats WKT versions 1 and 2 for coordinate reference systems and coordinate operations
  • Boost C++ libraries (C++): See Geometry io/wkt headers
  • Esri geometry-api-java
  • GEOS (C/C++)
  • Shapely (Python): See Shapely Documentation and Shapely in PyPI
  • GeoPHP (PHP)
  • GDAL (C/C++ with bindings to Java, Python, and others)
  • GeoRust: rust-wkt (Rust bindings)
  • JTS Topology Suite (Java)
  • NetTopologySuite (.NET)
  • OpenLayers (JavaScript)
  • OpenScales (ActionScript)
  • parsewkt (Python) is a peg parser from WKT to python dictionaries
  • pygeoif (Python) parses wkt with regular expressions
  • rgeo (Ruby)
  • sf (R)
  • Terraformer (JavaScript)
  • WkbDecoder (C# .Net) WKB Parser

6. Protocols That Provide Support

  • GeoSPARQL
  • SensorThings API

7. Variations

  • EWKT and EWKBExtended Well-Known Text/Binary – A PostGIS-specific format that includes the spatial reference system identifier (SRID) and up to 4 ordinate values (XYZM).[18][19] For example: SRID=4326;POINT(-44.3 60.1) to locate a longitude/latitude coordinate using the WGS 84 reference coordinate system.
  • AGF Text – Autodesk Geometry Format – An extension to OGC's Standard (at the time), to include curved elements; most notably used in MapGuide.[20]

References

  1. See the OGC Implementation Specification for geographic information – Simple Feature Access, section 6.1.11.1. http://www.opengeospatial.org/standards/sfa
  2. "Well-Known Text format (WKT) version 1". http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html. Retrieved 2016-11-01. 
  3. "OGC 12-063r5 Annex E". http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#148. Retrieved 2016-10-01. 
  4. "OGC 12-063r5". http://docs.opengeospatial.org/is/12-063r5/12-063r5.html. Retrieved 2015-05-06. 
  5. "ISO 19162:2015". http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=63094. Retrieved 2016-11-01. 
  6. "OGC 12-063r5 Backward compatibility". http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#20. Retrieved 2016-10-01. 
  7. "OGC 12-063r5 Annex C.3.3". http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#144. Retrieved 2016-10-01. 
  8. "OGC 12-063r5 Annex C.4.5". http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#145. Retrieved 2016-10-01. 
  9. Solr GEO support https://cwiki.apache.org/confluence/display/solr/Spatial+Search
  10. Well-Known Text (WKT) Input Type in Elasticsearch documentation https://www.elastic.co/guide/en/elasticsearch/reference/6.2/geo-shape.html#input-structure
  11. https://docs.marklogic.com/guide/search-dev/geospatial
  12. http://docs.memsql.com/docs/geospatial-guide
  13. Well-Known Text (WKT) Format, MySQL documentation http://dev.mysql.com/doc/refman/5.7/en/gis-data-formats.html
  14. https://neo4j-contrib.github.io/spatial/
  15. H2 create spatial index documentation http://www.h2database.com/html/grammar.html#create_index
  16. "HP Vertica 7.1.x Release Notes" (in en-us). https://my.vertica.com/docs/ReleaseNotes/7.1.x/HP_Vertica_7.1.x_Release_Notes.htm#HP%C2%A0Verti. 
  17. https://www.voltdb.com/company/press-releases/voltdb-adds-geospatial-query-support-industrys-innovative-fast-data-platform/
  18. https://github.com/postgis/postgis/blob/2.1.0/doc/ZMSgeoms.txt
  19. http://postgis.org/docs/ST_GeomFromEWKT.html
  20. http://e-logistic-plans.gdfsuez.com/mapguide/help/webapi/da/dc0/group___agf_text.htm
More
Information
Subjects: Others
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 2.6K
Entry Collection: HandWiki
Revision: 1 time (View History)
Update Date: 27 Oct 2022
1000/1000
Video Production Service