-
Notifications
You must be signed in to change notification settings - Fork 17
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
coordinates return a Vector of Vector #20
Comments
How might we handle jagged arrays using a Vector of Tuples? |
I might be misunderstanding the spec, but I meant each 2d or 3d point to be represented by a Tuple in the returned object (the innermost Array) - the outer ones can have variable length and should be arrays. Or am I getting this wrong? |
Yes, that should be possible. I just kept it to vectors for simplicity of implementation to get something going. |
I'll try to see if I can work this out, but it looks like the whole interface expects Vectors at the lowest level, so this would need changing lots of places, right? |
I suggest to use a StaticArrays.jl instead like I do in GeoStats.jl. Every coordinate is stack-allocated and still works in the context of linear algebra calculations. Basically a tuple on steroids. |
Sure, that works too.
Should be doable for this package, since I've isolated it to GeoInterface.jl/src/geotypes.jl Line 16 in 1ab41f2
More preferably, we should be using a holy-traits approach to representing the Positions such that Vectors and Tuples and StaticArrays (and others) can all work. |
That is another option - or perhaps even better using GeometryTypes.Point which is just a StaticArray. But definitely, I think a common abstraction for Points in Julia would be great. See also JuliaPlots/Plots.jl#1886 (comment) |
Why traits and not just using the same type? Nothing is simpler than Point. |
There's https://github.com/JuliaGeometry/meta/wiki/First-Meetup and https://github.com/JuliaGeometry/meta/wiki/First-Meetup-Minutes
Yup, that's the only hard part about it, no? Changing what an interface expects should be easy. What is more tedious is updating all the packages that implements it. |
I think that by using StaticArrays.jl, which is quite standard nowadays, we gain a lot of functionality for free. Reimplementing all the same operations for Point or any other type wouldn't be productive. A generic traits-based interface also sounds like a good path forward. I think the crux here is to keep in mind that points are just "vectors" and that people will definitely make linear algebra calculations with them. |
They are not mutually exclusive. The specific proposal is to
|
Have you made a decision on this? |
Closed by the traits interface of #33. |
Why not return a Vector of Tuples? Given that points are immutable. Tuples are stack allocated and much faster.
The text was updated successfully, but these errors were encountered: