Skip to content
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

Merged
merged 1 commit into from
May 2, 2021

Conversation

andyyang890
Copy link
Collaborator

Fixes #151.
Fixes #180.

@andyyang890 andyyang890 requested review from twpayne and otan April 22, 2021 00:22
@@ -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) {
Copy link
Collaborator

@otan otan Apr 22, 2021

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.

Copy link
Collaborator Author

@andyyang890 andyyang890 Apr 22, 2021

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:

  1. Should a GEOMETRYCOLLECTION{M, Z, ZM} be allowed to have geometries with different dimensions or does that only apply to GEOMETRYCOLLECTION?
  2. Should the layout for a GEOMETRYCOLLECTION always be geom.NoLayout?
  3. If the answer to 1 is no, should the layout of a *GeometryCollection be set if it is a GEOMETRYCOLLECTION{M, Z, ZM} or should it remain as geom.NoLayout?

Copy link
Owner

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.

@twpayne
Copy link
Owner

twpayne commented Apr 25, 2021

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.

@twpayne twpayne merged commit f26377c into twpayne:master May 2, 2021
@twpayne
Copy link
Owner

twpayne commented May 2, 2021

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.

@andyyang890 andyyang890 deleted the replace_wkt_parser branch May 3, 2021 15:40
@andyyang890
Copy link
Collaborator Author

Sounds good, thanks for the detailed review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WKT decoder could use re2c encoding/wkt: wkt decoding case and space insensitive
3 participants