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

map.setTerrain() throws error at max zoom #1650

Closed
321ckatz123 opened this issue Sep 15, 2022 · 3 comments · Fixed by #1871
Closed

map.setTerrain() throws error at max zoom #1650

321ckatz123 opened this issue Sep 15, 2022 · 3 comments · Fixed by #1871
Labels
bug Something isn't working good first issue Good for newcomers PR is more than welcomed Extra attention is needed terrain

Comments

@321ckatz123
Copy link

321ckatz123 commented Sep 15, 2022

maplibre-gl-js version: 2.4

browser: Chrome 105

Steps to Trigger Behavior

  1. Zoom the map all the way out (so you see multiple world copies) using your mouse wheel with terrain on with the map height relatively small (like 200px high in the example)
  2. See console errors (you should get something like Uncaught Error: x=-1419415165, y=-1073741824, z=-1 outside of bounds. 0<=x<0.5, 0<=y<0.5 0<=z<=25)
  3. If you turn terrain off, the error will go away

Link to Demonstration

https://jsbin.com/jitorijofo/edit?html,output

@321ckatz123
Copy link
Author

321ckatz123 commented Sep 15, 2022

image

A representative example of approx. how "big" the map should be as well as the errors thrown

@HarelM
Copy link
Collaborator

HarelM commented Sep 16, 2022

I think terrain uses Z - 2 tiles for optimization in some points, and in this case it uses negative Z by mistake.
Feel free to submit a PR to fix this.

@HarelM HarelM added bug Something isn't working PR is more than welcomed Extra attention is needed terrain good first issue Good for newcomers labels Sep 16, 2022
@sebastianoscarlopez
Copy link
Contributor

Maybe the real issue is that MapLibre allows negative zoom. How about fixing this issue by putting a constraint that zoom always must be greater than 0

Please take a look at this pr #1733

zbigniewmatysek-tomtom added a commit to tomtom-forks/maplibre-gl-js that referenced this issue Nov 15, 2022
HarelM pushed a commit that referenced this issue Nov 25, 2022
…1871)

* Prevent setting Transform tileZoom to negative value

* Remove unused Transform member, improve naming

* Add changelog entry; fix #1650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers PR is more than welcomed Extra attention is needed terrain
Projects
None yet
3 participants