Skip to content
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

Enforce coordinate eltype #53

Open
visr opened this issue May 16, 2022 · 4 comments
Open

Enforce coordinate eltype #53

visr opened this issue May 16, 2022 · 4 comments

Comments

@visr
Copy link
Member

visr commented May 16, 2022

Do we currently expect anything from the coordinate eltype? Was SF always Float64? What do we do, <:Real, <:AbstractFloat, or leave it open?

@evetion
Copy link
Member

evetion commented May 16, 2022

I think it should be <:Real.

I will put this into the documentation, so any enforcement is not a breaking change later on. I'm also not sure how enforcement would look like or we want to specify an eltype in the interface itself.

@evetion
Copy link
Member

evetion commented May 16, 2022

This is already in the documentation itself:
GeoInterface.getcoord(geomtype(geom), geom::customgeom, i)::Real

I clarified it in the docstring as well:

    getcoord(geom, i) -> Number
Return the `i`th coordinate for a given `geom`. A coordinate isa *`Real`*.
Note that this is only valid for individual [`AbstractPointTrait`](@ref)s.

@evetion evetion changed the title coordinate eltype Enforce coordinate eltype May 16, 2022
@visr
Copy link
Member Author

visr commented May 16, 2022

Yeah indeed I think just documenting it might be enough, rather than "enforcing". Of course some operations may only make sense on AbstractFloat coordinates, but that is up to the implementer.

@evetion
Copy link
Member

evetion commented May 16, 2022

@rafaqz brought up the point to change Real into Number so things like Unitful.jl could work. This wouldn't be a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants