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

BBox is Float or Int #77

Closed
KrOstir opened this issue Sep 1, 2021 · 2 comments · Fixed by #79
Closed

BBox is Float or Int #77

KrOstir opened this issue Sep 1, 2021 · 2 comments · Fixed by #79

Comments

@KrOstir
Copy link
Contributor

KrOstir commented Sep 1, 2021

Currently, BBox is defined as Float64.

bbox::NamedTuple{(:min_x, :min_y, :max_x, :max_y),Tuple{Float64, Float64, Float64, Float64}})

This is mostly true, but BBox can also be Int64. Or a combination of them (each element can be either Int or Float). GeoArrays does not handle this.

julia> GeoArrays.bbox_to_affine((10,10), (min_x=10, min_y=10, max_x=100, max_y=100))
ERROR: MethodError: no method matching bbox_to_affine(::Tuple{Int64, Int64}, ::NamedTuple{(:min_x, :min_y, :max_x, :max_y), NTuple{4, Int64}})
Closest candidates are:
  bbox_to_affine(::Tuple{Integer, Integer}, ::NamedTuple{(:min_x, :min_y, :max_x, :max_y), NTuple{4, Float64}})
@evetion
Copy link
Owner

evetion commented Sep 1, 2021

Agreed, this also should be fixed for a lot of other methods in the codebase.

@KrOstir
Copy link
Contributor Author

KrOstir commented Sep 1, 2021

Is it necessary to specify type?

Of course, it is beneficial, but if someone would try bbox with string or something else, errors will happen somewhere else 😀.

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