{"id":13427375,"url":"https://github.com/opengeospatial/wkt","last_synced_at":"2026-04-14T10:33:57.174Z","repository":{"id":137527717,"uuid":"391101105","full_name":"opengeospatial/wkt","owner":"opengeospatial","description":"A standalone reference describing the Well-known Text Representation of Geometry. (Work In Progress)","archived":false,"fork":false,"pushed_at":"2021-07-30T16:59:09.000Z","size":12,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-15T23:31:52.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opengeospatial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-07-30T14:55:13.000Z","updated_at":"2024-10-23T15:10:40.000Z","dependencies_parsed_at":"2024-02-06T05:58:33.166Z","dependency_job_id":null,"html_url":"https://github.com/opengeospatial/wkt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/opengeospatial/wkt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengeospatial%2Fwkt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengeospatial%2Fwkt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengeospatial%2Fwkt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengeospatial%2Fwkt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opengeospatial","download_url":"https://codeload.github.com/opengeospatial/wkt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengeospatial%2Fwkt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31793218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:02:01.112Z","updated_at":"2026-04-14T10:33:57.158Z","avatar_url":"https://github.com/opengeospatial.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# Well Known Text\n\nThis document provides a standalone reference describing the Well-known Text Representation of Geometry, which is fully specified in the \n[Simple Features Access](file:///Users/cholmes/Downloads/06-103r4_Implementation_Specification_for_Geographic_Information_-_Simple_feature_access_-_Part_1_Common_Architecture_v1.2.1.pdf)\nstandard, section 7 (TODO: provide a link directly to that section when there is an html version online).\n\n**WARNING: This is a work in progress, and should not yet be considered definitive in any way.** But we hope to have a finished version relatively soon.\n\n## About\n\nTODO: Describe what WKT is and what it's used for.\n\n### Contributing\n\nThis repository aims to be a definitive reference for Well Known Text. If you've ever been frustrated trying to find the official reference please help out! \nPull Requests are encouraged. We'll need some official review before this becomes a definitive reference, but we should iterate to make it more useful. Lots\nof todos throughout the text, and we'll likely evolve to using github issues. But we're also hoping to make this a 'little' thing, not a big deal, just get\nto an iterative improvement and 'ship it'.\n\n## Using Well Known Text\n\nWell Known Text is formally defined below, but its easier to get a sense of it by starting with some examples.\n| **Geometry Type** | **Text Literal Representation**                                                                                                                                                                                                                           | **Comment**                                                                             |\n|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|\n| Point             | POINT (10 10)                                                                                                                                                                                                                                             | a Point                                                                                 |\n| LineString        | LINESTRING (10 10, 20 20, 30 40)                                                                                                                                                                                                                          | a LineString with 3 points                                                              |\n| Polygon           | POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))                                                                                                                                                                                                             | a Polygon with 1 exteriorRing and 0 interiorRings                                       |\n| Multipoint        | MULTIPOINT ((10 10), (20 20))                                                                                                                                                                                                                             | a MultiPoint with 2 points                                                              |\n| MultiLineString   | MULTILINESTRING ((10 10, 20 20), (15 15, 30 15))                                                                                                                                                                                                          | a MultiLineString with 2 linestrings                                                    |\n| MultiPolygon      | MULTIPOLYGON ( ((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 70, 80 60, 60 60 )) )                                                                                                                                                                   | a MultiPolygon with 2 polygons                                                          |\n| GeomCollection    | GeometryCollection ( POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20) )                                                                                                                                                                            | a GeometryCollection consisting of 2 Point values and a LineString value                |\n| Polyhedron        | Polyhedron Z ( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1. 0 0 1)) ) | A polyhedron cube, corner at the origin and opposite corner at (1, 1, 1).               |\n| Tin               | Tin Z ( ((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 0 0 1, 0 0 0)), ((1 0 0, 0 1 0, 0 0 1, 1 0 0)), )                                                                                                                 | A tetrahedron (4 triangular faces), corner at the origin and each unit coordinatedigit. |\n| Point             | Point Z (10 10 5)                                                                                                                                                                                                                                         | A 3D Point                                                                              |\n| Point             | Point ZM (10 10 5 40)                                                                                                                                                                                                                                     | the same 3D Point with M value of 40                                                    |\n| Point             | Point M (10 10 40)                                                                                                                                                                                                                                        | a 2D Point with M value of 40                                                           |\n|                   |                                                                                                                                                                                                                                                           |                                                                                         |\n\nTODO: Revisit these examples, these are straight from the spec, but likely better to start with the core. Wikipedia does it much better, perhaps just copy \ntheirs, with the nice pictures as well: https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry\n\n## Definition\n\nNote: The core spec has 4 BNF definitions, for 2d, 3d, and 'measured' versions of each. For now we'll just include the 2d one (non-measured)\n\n### BNF Introduction\n\nThe Well-known Text Representation of Geometry is defined below using [BNF](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form).\n\n * The notation “{}” denotes an optional token within the braces; the braces do not appear in the output token\nlist.\n* The notation \"( )\" groups a sequence of tokens into a single token; the parentheses do not appear in the\noutput token list.\n* The notation \"*\" after a token denotes the optional use of multiple instances of that token.\n* A character string without any modifying symbols denotes an instance of that character string as a single\ntoken.\n* The notation \"|\" denotes a choice of two tokens, and do not appear in the output token list,\n* The notation \"\u003c \u003e\" denotes a production defined elsewhere in the list or a basic type.\n* The notation \":=\" is a production and the grammar on the left may be replaced with the grammar on the\nright of this symbol. Production is terminated when no undefined production equations are left unresolved.\n\nThe text representation of the instantiable Geometry Types implemented shall conform to this grammar. Well\nknown text is case insensitive. \n\n*Note: All productions are segregated by coordinate type. This means that any two subelements of any element\nwill always have the same coordinate type, which will be the coordinate type of the larger containing\nelement.* \n\nThe grammar in this and the following clause has been designed to support a compact and readable textual\nrepresentation of geometric objects. The representation of a geometric object that consists of a set of\nhomogeneous components does not include the tags for each embedded component. This first set of productions\nis to define a double precision literal. \n\n```\n\u003cx\u003e ::= \u003csigned numeric literal\u003e\n\u003cy\u003e ::= \u003csigned numeric literal\u003e\n\u003cz\u003e ::= \u003csigned numeric literal\u003e\n\u003cm\u003e ::= \u003csigned numeric literal\u003e\n\u003cquoted name\u003e ::= \u003cdouble quote\u003e \u003cname\u003e \u003cdouble quote\u003e\n\u003cname\u003e ::= \u003cletters\u003e\n\u003cletters\u003e ::= (\u003cletter\u003e)*\n\u003cletter\u003e ::= \u003csimple Latin letter\u003e|\u003cdigit\u003e|\u003cspecial\u003e\n\u003csimple Latin letter\u003e ::= \u003csimple Latin upper case letter\u003e|\u003csimple Latin lower case letter\u003e\n\u003csigned numeric literal\u003e ::= {\u003csign\u003e}\u003cunsigned numeric literal\u003e\n\u003cunsigned numeric literal\u003e ::= \u003cexact numeric literal\u003e|\u003capproximate numeric literal\u003e \n\u003capproximate numeric\nliteral\u003e ::=\n\u003cmantissa\u003eE\u003cexponent\u003e\n\u003cmantissa\u003e ::= \u003cexact numeric literal\u003e\n\u003cexponent\u003e ::= \u003csigned integer\u003e\n\u003cexact numeric literal\u003e ::= \u003cunsigned integer\u003e{\u003cdecimal point\u003e{\u003cunsigned integer\u003e}}|\u003cdecimal point\u003e\u003cunsigned integer\u003e\n\u003csigned integer\u003e ::= {\u003csign\u003e}\u003cunsigned integer\u003e\n\u003cunsigned integer\u003e ::= (\u003cdigit\u003e)*\n\u003cleft delimiter\u003e ::= \u003cleft paren\u003e|\u003cleft bracket\u003e // must match balancing right delimiter\n\u003cright delimiter\u003e ::= \u003cright paren\u003e|\u003cright bracket\u003e // must match balancing left delimiter\n\u003cspecial\u003e ::= \u003cright paren\u003e|\u003cleft paren\u003e|\u003cminus sign\u003e|\u003cunderscore\u003e|\u003cperiod\u003e|\u003cquote\u003e|\u003cspace\u003e\n\u003csign\u003e ::= \u003cplus sign\u003e | \u003cminus sign\u003e\n\u003cdecimal point\u003e ::= \u003cperiod\u003e | \u003ccomma\u003e\n\u003cempty set\u003e ::= EMPTY\n\u003cminus sign\u003e ::= -\n\u003cleft paren\u003e ::= (\n\u003cright paren\u003e ::= )\n\u003cleft bracket\u003e ::= [\n\u003cright bracket\u003e ::= ]\n\u003cperiod\u003e ::= .\n\u003cplus sign\u003e ::= +\n\u003cdouble quote\u003e ::= \"\n\u003cquote\u003e ::= '\n\u003ccomma\u003e ,\n\u003cunderscore\u003e ::= _ \n\u003cdigit\u003e ::= 0|1|2|3|4|5|6|7|8|9\n\u003csimple Latin lower caseletter\u003e ::= a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z\n\u003csimple Latin upper case letter\u003e ::= A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z\n\u003cspace\u003e= \" \"// unicode \"U+0020\" (space) \n```\nTODO: Get some better formatting here. The [CQL.bnf](https://github.com/opengeospatial/ogcapi-features/blob/e4912fa8e6f285acbbc03b5595dbbab29659f4b2/extensions/cql/standard/schema/cql.bnf) \nfeels a lot cleaner, but it seems to use different BNF, so need to figure out how that all works. These could probably go in separate documents, and keep the main\ndocument cleaner - just talk through how it works and give examples\n\n## BNF Productions for Two-Dimension Geometry WKT \n\nThe following BNF defines two-dimensional geometries in (x, y) coordinate spaces. With the exception of the\naddition of polyhedral surfaces, these structures are unchanged from earlier editions of this standard. \n\n```\n\u003cpoint\u003e ::= \u003cx\u003e \u003cy\u003e\n\u003cgeometry tagged text\u003e ::= \u003cpoint tagged text\u003e | \u003clinestring tagged text\u003e | \u003cpolygon tagged text\u003e | \u003ctriangle tagged text\u003e | \u003cpolyhedralsurface tagged text\u003e | \u003ctin tagged text\u003e | \u003cmultipoint tagged text\u003e | \u003cmultilinestring tagged text\u003e | \u003cmultipolygon tagged text\u003e| \u003cgeometrycollection tagged text\u003e\n\u003cpoint tagged text\u003e ::= point \u003cpoint text\u003e\n\u003clinestring tagged text\u003e ::= linestring \u003clinestring text\u003e\n\u003cpolygon tagged text\u003e ::= polygon \u003cpolygon text\u003e\n\u003cpolyhedralsurface tagged text\u003e ::= polyhedralsurface \u003cpolyhedralsurface text\u003e\n\u003ctriangle tagged text\u003e ::= triangle \u003cpolygon text\u003e\n\u003ctin tagged text\u003e tin \u003cpolyhedralsurface text\u003e\n\u003cmultipoint tagged text\u003e ::= multipoint \u003cmultipoint text\u003e\n\u003cmultilinestring tagged text\u003e ::= multilinestring \u003cmultilinestring text\u003e\n\u003cmultipolygon tagged text\u003e ::= multipolygon \u003cmultipolygon text\u003e\n\u003cgeometrycollection tagged text\u003e ::= geometrycollection\n\u003cgeometrycollection text\u003e\n\u003cpoint text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cpoint\u003e \u003cright paren\u003e \n\u003clinestring text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cpoint\u003e {\u003ccomma\u003e \u003cpoint\u003e}* \u003cright paren\u003e\n\u003cpolygon text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003clinestring text\u003e {\u003ccomma\u003e \u003clinestring text\u003e}* \u003cright paren\u003e\n\u003cpolyhedralsurface text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cpolygon text\u003e {\u003ccomma\u003e \u003cpolygon text\u003e}* \u003cright paren\u003e\n\u003cmultipoint text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cpoint text\u003e {\u003ccomma\u003e \u003cpoint text\u003e}* \u003cright paren\u003e\n\u003cmultilinestring text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003clinestring text\u003e {\u003ccomma\u003e \u003clinestring text\u003e}* \u003cright paren\u003e\n\u003cmultipolygon text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cpolygon text\u003e {\u003ccomma\u003e \u003cpolygon text\u003e}* \u003cright paren\u003e\n\u003cgeometrycollection text\u003e ::= \u003cempty set\u003e | \u003cleft paren\u003e \u003cgeometry tagged text\u003e {\u003ccomma\u003e \u003cgeometry tagged text\u003e}* \u003cright paren\u003e \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengeospatial%2Fwkt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopengeospatial%2Fwkt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengeospatial%2Fwkt/lists"}