-
Notifications
You must be signed in to change notification settings - Fork 25
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
Store a single geometry inside Wkt #72
Conversation
@@ -131,28 +131,19 @@ pub struct Wkt<T> | |||
where | |||
T: WktFloat, | |||
{ | |||
pub items: Vec<Geometry<T>>, | |||
pub item: Geometry<T>, |
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.
Wkt<T>(Geometry<T>)
might be better here? Not sure.
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.
No strong opinion from me, but I have a slight preference for how you have it.
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 I'd prefer renaming Geometry
to Wkt
or an into_geometry()
method.
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.
No strong opinion from me, but I have a slight preference for how you have it.
Same, but do what you feel is best here. Where does the into_geometry()
method come into it?
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.
Where does the into_geometry() method come into it?
I meant Wkt::into_geometry(self) -> Geometry
.
I'd say keep item
for now and maybe change it in a follow-up PR if we figure out a better way.
I just noticed that
|
I think it actually failed, but I fixed it in the meantime and did a force-push. |
Oh you're right! Sorry. |
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 have one non-blocking reservation: Does this break conformance with the spec? I pretty quickly surrendered before the very long and (to me) unnavigable spec.
More pragmatically, I tested that this seems to align us with the behavior of postgis: Like the highlander, There can be only one top level geometry.
eg. postgis will not parse an entity like:
sql=# SELECT ST_GeomFromText('POINT(1 2) POINT(2 3)');
ERROR: parse error - invalid geometry
HINT: "POINT(1 2) POINT(2 " <-- parse error at position 19 within geometry
sql=# SELECT ST_GeomFromText('POINT(1 2), POINT(2 3)');
ERROR: parse error - invalid geometry
HINT: "POINT(1 2), PO" <-- parse error at position 14 within geometry
So, the only way to have multiple geometries in postgis, like in this PR, is to explicitly wrap with a Geometry Collection:
SELECT ST_GeomFromText('GEOMETRYCOLLECTION(POINT(1 2), POINT(2 3))');
So this LGTM, but let's see what @urschrei thinks.
It's just as conforming as the parser, since it (before my PR) parsed only one geometry out of the string. |
I feel the same: we're in line with PostGIS, in a less confusing way than before, so lgtm. |
🔒 Permission denied Existing reviewers: click here to make lnicola a reviewer |
Added! Can you please try again? |
bors r+ |
Build succeeded: |
I like how it almost takes longer to install |
CHANGES.md
if knowledge of this change could be valuable to users.r? @urschrei