Comments (13)
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.
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.
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.
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.
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.
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.
it would be good to support it behind a feature flag
That sounds like a smart approach to me.
from wkt.
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.
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.
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.
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.
I support it!
from wkt.
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)
- Relax ToWkt impls to work with CoordNum HOT 1
- Support deserializing integer geometries HOT 2
- release 0.11.0 HOT 2
- Add Support For EWKT
- MultiPoint should handle mix of EMPTY and non Empty points
- 3D point is spelled `POINT Z` not `POINTZ` HOT 11
- Better way to serialize to wkt? HOT 5
- Publish WKT 0.9.0 HOT 4
- `POINT EMPTY` vis-à-vis `geo_types` HOT 2
- WKT Release: proposed minor release 0.9.1 HOT 1
- Wkt parser should parses geometry type as case insensitive HOT 2
- Next release (0.9.2) HOT 1
- Remove ToWkt? HOT 19
- Make geo-types a non-optional dependency HOT 3
- Add MIT license file HOT 1
- How to pass GEOMETRYCOLLECtion from sql HOT 1
- make Wkt<T> display HOT 3
- Use new TZM geo-types instead the custom WKT ones HOT 12
- Avoid intermediate `Wkt` allocation for `ToWkt::wkt_string` for geo-types
- Output `TRIANGLE` type? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wkt.