-
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
Add an interface for reverse lookups of package geometry types #80
Comments
Fully agree, I think I described it somewhere as |
Do you think that in practice we can ignore that multiple packages can have the same name and dispatch on |
I'd say yeah, let's ignore it, although it would be good to check what kind of error you would get if it happens (creating a clone package locally or similar). Probably just overwrites the method definition? |
I think whatever package is loaded last will override the method. |
implemented |
I'm running some code over a feature collection where I'm converting GeoJSON objects to GeometryBasics objects.
It's annoying because the collection has a mix of geometry types, so I have to check for each type and find the correct GeometryBasics.jl object to convert to.
If we had a method like
GeometryBasics.geomtrait_type(PolygonTrait())
I could use that likeAnd the code would be generic for all objects GeometryBasics.jl actually implements.
This wouldn't be an interface method, but a package method with a consistent name across all packages so users can find it. A way to make it an actual interface method could be to dispatch on the
Symbol
name of the package like :but it's a bit of a hack and ignores that package UUIDs allow multiple identical named packages.
It would also be amazing to do:
And it just works without knowing the package geometry type. This method would be a step in that direction.
The text was updated successfully, but these errors were encountered: