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

Determine WKT parsing strictness #200

Open
twpayne opened this issue May 2, 2021 · 1 comment
Open

Determine WKT parsing strictness #200

twpayne opened this issue May 2, 2021 · 1 comment

Comments

@twpayne
Copy link
Owner

twpayne commented May 2, 2021

This is opened from the comments from @otan and @andyyang890 in #197.

@otan wrote:

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.

@andyyang890 replied:

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?
@twpayne
Copy link
Owner Author

twpayne commented May 2, 2021

My thoughts:

  1. GeometryCollections are under-specified by the OGC and rarely used in practice (to my knowledge). It is fantastic that we're considering all the edge cases here, but I'm happy to leave the behavior as-is and wait for users to report problems if/when they encounter them in practice.
  2. PostGIS is the de facto open source standard and we should follow its behavior by default.
  3. There are many different ways that geometries can be invalid. For the purposes of go-geom I'm happy to focus on representation and defer validation. Validation is hard to do and is best served by battle-tested libraries like GEOS.

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

No branches or pull requests

1 participant