-
Notifications
You must be signed in to change notification settings - Fork 200
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
Coordinate vs. Point #15
Comments
a multipoint would be made up of multiple coordinates, not multiple points, same for lines |
hmm... I don't understand yet. What is the difference between the two? The name |
so in geojson a coordinate is simply an array of 2 (or more) values {
"type": "Point",
"coordiantes": [x, y]
} and a multipoint {
"type": "MultiPoint",
"coordiantes": [[x, y], [x, y]]
} A Coordinate is a primitive type and a point is a geometry type |
Okay, I understand how this could be modeled around the GeoJSON representation. On the other hand GeoJSON is limited in that it only has objects and no other/custom types like e.g. Point or MultiPoint. The The current definition of I guess my main question is: why not merge I think the API could probably be simplified quite a bit if the two types are merged into one. |
oh woops I missed that multipoint is made up of points nood coords |
This simplifies the Point API and removes an unnecessary abstraction level. Resolves georust#15
Relevant discussion also happening in #16 |
@frewsxcv I've thought about this a bit more and maybe it would make more sense to have a |
So going back to earlier discussions in this thread, we should clarify
Thoughts anyone? Anyone know counter-examples? Otherwise, I think it makes sense to align ourselves with other libraries instead of doing our own thing. EDIT: typos |
I think it is the right thing to separate between points and coordinates. This could allow to have 2D and 3D coordinates. Additionally a geometry (Point, Line, ...) might have properties similar to geojson and/or a coordinate system which would be redundant for each coordinate. |
+1 to going with what the other libs (JTS and GEOS, in particular), are doing. |
for that discussion we should clarify what the difference between a using WKT and GeoJSON as examples is not useful IMHO because those are untyped data structures, while we are dealing with a typed language. |
At some point rust-geo will switch to traits for all geometry types #67. So if Here is the definition of JTS coordinates:
|
@jdroenner thanks for that quote. I think that definition makes sense and using traits for everything seems like a good idea too. |
After implementing geometry traits for rust-postgis I've changed may mind and I'm also for a distinction between |
Relevant conversation in #15. This is a breaking change for `geo-types`.
Relevant conversation in #15. This is a breaking change for `geo-types`.
Relevant conversation in #15. This is a breaking change for `geo-types`.
244: Migrate Line/LineString to be a series of Coordinates (not Points). r=urschrei a=frewsxcv Relevant conversation in #15. This is a breaking change for `geo-types`. I'm _not_ planning to publish a release if this merges. I have a couple other breaking changes I'd like to consider before bumping the Rust geo ecosystem. Co-authored-by: Corey Farwell <[email protected]>
I believe this has been addressed - all geometries are backed by Coordinates now, not points. |
Allow Wkt items to be EMPTY
Every year or so, I come back to this issue and stare into the void. For the record, I think it'd be nice to consolidate the Point and Coord structs. They offer no practical difference and the difference frequently trips people up. A more practical approach might be #901 |
Staring into this void again. I'm going to re-open this issue.
One thing that a coordinate trait would not solve are algorithms that need to return a coordinate. We have a lot of algorithms which return a coordinate (or point!). So we ultimately need at least one concrete type (but I contend that we don't need both concrete types!) Other than the fact that this would be a very big breaking change, does anyone actually think it's a bad idea to get rid of the Coord structure and just use Point everywhere? Edit: just to clarify, this is not an argument against a point/coord trait - we could (probably should) still do that. Here I am orthogonally arguing for merging the existing concrete |
GEOS only has a point, right? I don't think it has a coordinate concept, and they get by fine |
I have always been on board with a single 1D type. |
Sheesh, how would we go about implementing this without blowing up the entire codebase. I think in any case it would be a large change. I don't think any of the changes will be conceptually difficult, it's just a ton of very mechanical changes. One way to make the change a little more piece-meal could be to unify the coords/point accessors - to wit, getting rid of the public field accessors on Coord, and merging those changes first: - coord.x + coord.y
+ coord.x() + coord.y()
- Coord { x: 1, y: 2 }
+ coord!(x: 1, y: 2)
+ Coord::new(x: 1, y: 2)
- coord.x += 7
+ coord.x_mut() += 7 Maybe this PR is already controversial enough though 😆 It's not so much that I'm opposed to doing the work, but more so that the bigger it is, the less likely it will be reviewed, and the more ripe it will be for merge conflicts. |
agreed that seems like a way to minimize the per-PR diff |
what is the purpose of having a
Coordinate
and aPoint
type? it seems to me that havingPoint
should be sufficient.The text was updated successfully, but these errors were encountered: