{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6911","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-js","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6911/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6911/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6911/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/6911","id":338095658,"node_id":"MDU6SXNzdWUzMzgwOTU2NTg=","number":6911,"title":"Function to check (or gracefully fail) if bounds is invalid for fitBounds()","user":{"login":"hyperknot","id":494223,"node_id":"MDQ6VXNlcjQ5NDIyMw==","avatar_url":"https://avatars2.githubusercontent.com/u/494223?v=4","gravatar_id":"","url":"https://api.github.com/users/hyperknot","html_url":"https://github.com/hyperknot","followers_url":"https://api.github.com/users/hyperknot/followers","following_url":"https://api.github.com/users/hyperknot/following{/other_user}","gists_url":"https://api.github.com/users/hyperknot/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperknot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperknot/subscriptions","organizations_url":"https://api.github.com/users/hyperknot/orgs","repos_url":"https://api.github.com/users/hyperknot/repos","events_url":"https://api.github.com/users/hyperknot/events{/privacy}","received_events_url":"https://api.github.com/users/hyperknot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-04T00:44:07Z","updated_at":"2018-07-05T17:52:30Z","closed_at":"2018-07-05T17:52:30Z","author_association":"NONE","body":"1. I'm using '@turf/bbox' to generate the bounding box for all visible features.\r\n2. This bounding box can sometimes include \"Infinity\" values, which breaks `fitBounds`.\r\n3. Thus I'm manually checking with `bounds.includes(Infinity)` before every time I'm calling `fitBounds`.\r\n4. This works well, but it turns out there are some cases when the bounds are not \"Infinity\", but just some huge number, which also fails fitBounds.\r\n\r\nOne such example is:\r\n```\r\n[5.8488465, 36.5302427, 697804, 5010733]\r\n```\r\n\r\nSince a fit to all visible features is such a basic use case for all mapping libraries, I recommend to either:\r\n\r\n1. Gracefully fail in fitBounds, without an exception, with a console warning maybe.\r\nor\r\n2. Make a function which checks if a LngLatBoundsLike object is valid for fitBounds. I don't know how should wrapping be handled, what exact input is allowed for fitBounds, etc. but there should be a function which can check all the specs.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/402803007","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/6911#issuecomment-402803007","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/6911","id":402803007,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjgwMzAwNw==","user":{"login":"ryanhamley","id":4523080,"node_id":"MDQ6VXNlcjQ1MjMwODA=","avatar_url":"https://avatars1.githubusercontent.com/u/4523080?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanhamley","html_url":"https://github.com/ryanhamley","followers_url":"https://api.github.com/users/ryanhamley/followers","following_url":"https://api.github.com/users/ryanhamley/following{/other_user}","gists_url":"https://api.github.com/users/ryanhamley/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanhamley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanhamley/subscriptions","organizations_url":"https://api.github.com/users/ryanhamley/orgs","repos_url":"https://api.github.com/users/ryanhamley/repos","events_url":"https://api.github.com/users/ryanhamley/events{/privacy}","received_events_url":"https://api.github.com/users/ryanhamley/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T17:52:30Z","updated_at":"2018-07-05T17:52:30Z","author_association":"CONTRIBUTOR","body":"Thanks for this @hyperknot! This is very similar to #6906. I'll add some tests to ensure values like this get handled properly, but I'm going to close this ticket since the solution is already being tracked in the other issue."}}
{"actor":{"display_login":"ryanhamley"}}