Git Product home page Git Product logo

Comments (13)

lnicola avatar lnicola commented on August 25, 2024 1

Feature-gated enum values are a bit weird. Take this example:

  • program P uses crates C1 and C2
  • crates C1 and C2 use wkt
  • crate C2 enables the linearring feature
  • crate C1 stops building because it's no longer exhaustively matching a wkt::Geometry value

C1 could prevent this by adding fallback match branches. Alternatively, wkt could mark Geometry as non_exhaustive to force dependent crates to use a fallback when matching against it. But neither solution seems ideal.

from wkt.

lnicola avatar lnicola commented on August 25, 2024 1

We could also have a variant for it and a normalization method, but I'd go for silently converting them until a user asks for more support.

from wkt.

rmanoka avatar rmanoka commented on August 25, 2024 1

Any further thoughts on this? I like the idea of silently reading LINEARRING and converting to LineString. Adding support for shapely and JTS extensions seems like a win for good interop.

from wkt.

frewsxcv avatar frewsxcv commented on August 25, 2024

https://geos.osgeo.org/doxygen/classgeos_1_1io_1_1WKTWriter.html

GEOS also uses it apparently

A non-standard "LINEARRING" tag is used for LinearRings. The WKT spec does not define a special tag for LinearRings. The standard tag to use is "LINESTRING".

Not sure! My initial feeling is LINEARRING could be behind a feature flag? Though I'd love to hear how commonly it gets used, though not sure how to do that

from wkt.

rmanoka avatar rmanoka commented on August 25, 2024

For comparison: openlayers seems to have considered this a while back (openlayers/openlayers#2679). IIUC, they did not support it! However, given JTS, geos and shapely output it, it would be good to support it behind a feature flag.

from wkt.

rmanoka avatar rmanoka commented on August 25, 2024

Along the same lines as this issue: JTS, geos, shapely also seem to support nan, inf, etc. in WKT. They have an "is_valid" predicate that'll be false, but allow conversion to / from wkt with nans. Eg. POINT (nan 0.0) or POINT (10 inf)

from wkt.

michaelkirk avatar michaelkirk commented on August 25, 2024

it would be good to support it behind a feature flag

That sounds like a smart approach to me.

from wkt.

rmanoka avatar rmanoka commented on August 25, 2024

Should we support LINEARRING as another enum-case to the Geometry type here? Then, convert to LineString in the conversion to geo-types?

from wkt.

rmanoka avatar rmanoka commented on August 25, 2024

Nice catch @lnicola ; I am also convinced against feature-gated addition to the enums. Should we then store the name of the tag in addition for this variant? We could also silently convert it to a linestring, but then parsing and writing back changes the wkt.

from wkt.

michaelkirk avatar michaelkirk commented on August 25, 2024

To make sure I understand: by "silently convert", do you mean that any linestring which is closed will be serialized to WKT as LINEARRING?

Would that behavior be behind a feature flag?

from wkt.

lnicola avatar lnicola commented on August 25, 2024

I meant reading LINEARRING as LineString, without a feature flag. It changes the WKT if you read and write back a file, but maybe it won't bother anyone.

from wkt.

michaelkirk avatar michaelkirk commented on August 25, 2024

I support it!

from wkt.

michaelkirk avatar michaelkirk commented on August 25, 2024

Fixed in #67

We might choose to do more in the future, but let's see what people's actual use cases are when they come up.

from wkt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.