-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/wkt: replace wkt parser with goyacc parser #197
Conversation
@@ -57,5 +59,10 @@ func Marshal(g geom.T, applyOptFns ...EncodeOption) (string, error) { | |||
|
|||
// Unmarshal translates a WKT to the corresponding geometry. | |||
func Unmarshal(wkt string) (geom.T, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think in go-geom, we want to relax things we check in CockroachDB (subject to @twpayne guidance!) as go-geom takes a more "OGC spec" view of the world, namely:
a) geometrycollections can have mixed dimensions.
b) linestrings/polygons do not have to have 2/4 points respectively, and polygon rings don't have to be closed.
c) i think empty can be mixed willy nilly in MultiPoint.
we can choose to optionally allow these checks (but have them off by default). this should be done with options -- see how we did the EncodeOption
for Marshal
above. probably DecodeOptionRunPostGISCompatibilityChecks
which enables all the checks we did above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a) geometrycollections can have mixed dimensions.
If the PostGIS compatibility option is not specified:
- Should a
GEOMETRYCOLLECTION{M, Z, ZM}
be allowed to have geometries with different dimensions or does that only apply toGEOMETRYCOLLECTION
? - Should the layout for a
GEOMETRYCOLLECTION
always begeom.NoLayout
? - If the answer to 1 is no, should the layout of a
*GeometryCollection
be set if it is aGEOMETRYCOLLECTION{M, Z, ZM}
or should it remain asgeom.NoLayout
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good points! I've opened #200 to continue the discussion.
Thank you @andyyang890 - this is a fantastic contribution! I just back from a few days away but will review in detail in the next couple of days. |
Thank you so much for this @andyyang890! The code is excellent, and thank you in particularly for the detail in handling edge cases. I'll patch up the lint failure in a separate PR. |
Sounds good, thanks for the detailed review! |
Fixes #151.
Fixes #180.