Skip to content

Instantly share code, notes, and snippets.

@namedgraph
Last active September 19, 2022 15:09
Show Gist options
  • Save namedgraph/36f9f7401556c9884da48716e9898bc5 to your computer and use it in GitHub Desktop.
Save namedgraph/36f9f7401556c9884da48716e9898bc5 to your computer and use it in GitHub Desktop.
WKT EBNF
well_known_text_representation ::=
point_text_representation |
curve_text_representation |
surface_text_representation |
collection_text_representation
point_text_representation ::= "POINT" space? z_m? space? point_text
curve_text_representation ::=
linestring_text_representation |
circularstring_text_representation |
compoundcurve_text_representation
linestring_text_representation ::=
"LINESTRING" space? z_m? space? linestring_text_body
circularstring_text_representation ::=
"CIRCULARSTRING" space? z_m? space? circularstring_text
compoundcurve_text_representation ::=
"COMPOUNDCURVE" space? z_m? space? compoundcurve_text
surface_text_representation ::=
curvepolygon_text_representation
curvepolygon_text_representation ::=
"CURVEPOLYGON" space? z_m? space? curvepolygon_text_body |
polygon_text_representation |
triangle_text_representation
polygon_text_representation ::=
"POLYGON" space? z_m? space? polygon_text_body
triangle_text_representation ::=
"TRIANGLE" space? z_m? space? triangle_text_body
collection_text_representation ::=
multipoint_text_representation |
multicurve_text_representation |
multisurface_text_representation |
geometrycollection_text_representation
multipoint_text_representation ::=
"MULTIPOINT" space? z_m? space? multipoint_text
multicurve_text_representation ::=
"MULTICURVE" space? z_m? space? multicurve_text |
multilinestring_text_representation
multilinestring_text_representation ::=
"MULTILINESTRING" space? z_m? space? multilinestring_text
multisurface_text_representation ::=
"MULTISURFACE" space? z_m? space? multisurface_text |
multipolygon_text_representation |
polyhedralsurface_text_representation |
tin_text_representation
multipolygon_text_representation ::=
"MULTIPOLYGON" space? z_m? space? multipolygon_text
polyhedralsurface_text_representation ::=
"POLYHEDRALSURFACE" space? z_m? space? polyhedralsurface_text
tin_text_representation ::=
"TIN" space? z_m? space? tin_text
geometrycollection_text_representation ::=
"GEOMETRYCOLLECTION" space? z_m? space? geometrycollection_text
linestring_text_body ::=
linestring_text
curvepolygon_text_body ::=
curvepolygon_text
polygon_text_body ::=
polygon_text
triangle_text_body ::=
triangle_text
point_text ::=
empty_set |
left_paren point right_paren
point ::= x space y (space z)? (space m)?
x ::= number
y ::= number
z ::= number
m ::= number
linestring_text ::=
empty_set |
left_paren space? point space? ( comma space? point space? )* right_paren
circularstring_text ::=
empty_set |
left_paren space? point space? ( comma space? point space? )* right_paren
compoundcurve_text ::=
empty_set |
left_paren space? single_curve_text space? ( comma space? single_curve_text space? )* right_paren
single_curve_text ::=
linestring_text_body |
circularstring_text_representation
curve_text ::=
linestring_text_body |
circularstring_text_representation |
compoundcurve_text_representation
ring_text ::=
linestring_text_body |
circularstring_text_representation |
compoundcurve_text_representation
surface_text ::=
"CURVEPOLYGON" space? curvepolygon_text_body |
polygon_text_body
curvepolygon_text ::=
empty_set |
left_paren space? ring_text space? ( comma space? ring_text space? )* right_paren
polygon_text ::=
empty_set |
left_paren space? linestring_text space? ( comma space? linestring_text space? )* right_paren
triangle_text ::=
empty_set |
left_paren space? linestring_text space? right_paren
multipoint_text ::=
empty_set |
left_paren space? point_text space? ( comma space? point_text space? )* right_paren
multicurve_text ::=
empty_set |
left_paren space? curve_text space? ( comma space? curve_text space? )* right_paren
multilinestring_text ::=
empty_set |
left_paren space? linestring_text_body space? ( comma space? linestring_text_body space? )* right_paren
multisurface_text ::=
empty_set |
left_paren space? surface_text space? ( comma space? surface_text space? )* right_paren
multipolygon_text ::=
empty_set |
left_paren space? polygon_text_body space? ( comma space? polygon_text_body space? )* right_paren
polyhedralsurface_text ::=
empty_set |
left_paren space? polygon_text_body space? ( comma space? polygon_text_body space? )* right_paren
tin_text ::=
empty_set |
left_paren space? triangle_text_body space? ( comma space? triangle_text_body space? )* right_paren
geometrycollection_text ::=
empty_set |
left_paren space? well_known_text_representation space? ( comma space? well_known_text_representation space? )* right_paren
<?TOKENS?>
space ::= ' '
empty_set ::= "EMPTY"
z_m ::= "ZM" | "Z" | "M"
left_paren ::= "("
right_paren ::= ")"
number ::= ('+'|'-')?([0-9]+('.'[0-9]*)?|'.'[0-9]+)(('e'|'E')('+'|'-')?[0-9]+)?
comma ::= ','
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment