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

Raise a ValueError when nan bounds are passed to tiles #120

Merged
merged 2 commits into from May 31, 2023

Conversation

samn
Copy link
Contributor

@samn samn commented May 30, 2023

Otherwise the coordinate could get unintentionally clamped to the TMS' extremeties:

# Clamp bounding values.
w = max(self.bbox.left, w)
s = max(self.bbox.bottom, s)
e = min(self.bbox.right, e)
n = min(self.bbox.top, n)

>>> from math import nan
>>> max(nan, -180)
nan
>>> min(nan, 180)
nan
>>> max(-180, nan)
-180
>>> min(180, nan)
180

Otherwise the coordinate could get unintentionally clamped to the TMS' extremeties:
https://github.com/developmentseed/morecantile/blob/248cbc56d306d047e7ec1aaf559b3928e9c18c37/morecantile/models.py#L885-L889

```python
>>> from math import nan
>>> max(nan, -180)
nan
>>> min(nan, 180)
nan
>>> max(-180, nan)
-180
>>> min(180, nan)
180
```
@vincentsarago
Copy link
Member

Sounds go to me 👍

If you are able to add a note in the changelog that would be lovely, if not I'll do it later tonight or tomorrow

@samn
Copy link
Contributor Author

samn commented May 30, 2023

Updated the changelog. Thanks @vincentsarago!

@vincentsarago vincentsarago merged commit 59a2453 into developmentseed:main May 31, 2023
5 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants