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

fitBounds with -90 results in uncaught error #6906

Closed
tristen opened this issue Jul 3, 2018 · 1 comment
Closed

fitBounds with -90 results in uncaught error #6906

tristen opened this issue Jul 3, 2018 · 1 comment
Labels

Comments

@tristen
Copy link
Member

tristen commented Jul 3, 2018

This must have been introduced in a recent version but calling fitBounds with a bounding box containing -90 results in an uncaught error.

screen shot 2018-07-03 at 9 37 20 am

mapbox-gl-js version:
v0.46.0

browser:
Chrome Version 67.0.3396.99 (Official Build) (64-bit)

Steps to Trigger Behavior

Call fitBounds with a sw latitude coordinate of -90

Link to Demonstration

https://jsfiddle.net/tristen/bytzwu08/ Click "Fit bounds" and view the console

@ryanhamley
Copy link
Contributor

Hi @tristen, thanks for the great report! This isn't a bug per se, but rather an inherent limitation of the Mercator map projection. Mercator maps project the poles at infinity making it impossible to fully render them (both on the web and on paper). Specifically, the Web Mercator projection that Mapbox uses is unable to accurately project latitudes north of 85.05° and south of -85.05°.

I think your report points to a couple of improvements that we can implement however. One is to clamp latitude inputs to the supported range and another is to log a warning to the console alerting the user that this is being done. I'm going to leave this open for now so we can use the ticket to track those improvements.

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

No branches or pull requests

2 participants