Skip to content

Commit

Permalink
WKT might contain a Spatial Reference System Identifier (SRID) at the…
Browse files Browse the repository at this point in the history
… beginning

This change adds the optional SRID to the grammar, contains a newly generated
parser and a test case for a WKT with SRID.
  • Loading branch information
jze committed Feb 2, 2025
1 parent 95098b3 commit 7c0cfb5
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 276 deletions.
10 changes: 10 additions & 0 deletions frictionless/fields/__spec__/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def test_string_read_cell(format, source, target):
"format, source, target",
[
("wkt", "POINT (30 10)", "POINT (30 10)"),
(
"wkt",
"POINT (574009.086492192 6028393.69530573)",
"POINT (574009.086492192 6028393.69530573)",
),
(
"wkt",
"SRID=25832;POINT (574009.086492192 6028393.69530573)",
"SRID=25832;POINT (574009.086492192 6028393.69530573)",
),
("wkt", "LINESTRING (30 10, 10 30, 40 40)", "LINESTRING (30 10, 10 30, 40 40)"),
(
"wkt",
Expand Down
7 changes: 7 additions & 0 deletions frictionless/vendors/wkt/grammar.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
wkt_representation =
srid_specification wkt_representation_body |
wkt_representation_body;

wkt_representation_body =
point_text_representation |
curve_text_representation |
surface_text_representation |
collection_text_representation;

srid_specification =
"SRID=" number ";";

point_text_representation = "POINT" [ z_m ] point_text;

curve_text_representation =
Expand Down
Loading

0 comments on commit 7c0cfb5

Please sign in to comment.