-
Notifications
You must be signed in to change notification settings - Fork 44
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
fix(bq,sf,rs,pg|quadbin): improve precision of long lat conversion near the latitude limits #461
Conversation
Once this is merged: CartoDB/quadbin-py#17 |
This pull request has been linked to Shortcut Story #373977: Improve precision of long lat conversion near the latitude limits. |
Dedicated carto environment deployed in Redshift host redshift-serverless-shared.515242991920.us-east-1.redshift-serverless.amazonaws.com and carto_dev_data database |
Dedicated environment removed |
Description
Shortcut
Experimental improvement of the QUADBIN_FROMLONGLAT lattitude clipping.
The formula that computes the quadbin Y coordinate from the latitude is unstable near the latitude limits (+/- 85.05112877980659). Because of this, we were clipping the latitude with a smaller value (85.05) to avoid errors that would assign an incorrect quadbin value to latitudes near the limit.
It seems better to clip the values of
LN((1 + __sinlat) / (1 - __sinlat)) / pi
instead of the input latitude.A clipping of the input is maintained to avoid errors with latitude=90 or incorrectvalues with latitude>90 (same for negative values). Note it's questionable to allow and clip values greater than 90, because BigQuery would not allow creating a geography with them, and in any case they could be interpreted modulo 90 (so that 130 could be interpreted as 40, and not clipped).
Acceptance
For negative latitudes: