-
Notifications
You must be signed in to change notification settings - Fork 40
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
Incorrect zoom for some bounds #30
Comments
I am having the same issue. The amount its off by varies between cases so I can't even take a specific fraction of the zoom. |
Does it make a difference when you specify the pixel size? Leaflet and GL JS zooms are off by one because of the tileSize so wonder if that could be the reason here? |
Yes, changing the tile size to 512 fixed the issue! Thank you! I should have read the bottom part of the readme more closely. The blog link at the bottom is broken, I believe I found the correct post. Will open an MR with the new link. |
For some bounds it calculates incorrect zoom, for example here
[-112.16601, 37.622623, -112.082016, 37.672085]
it calculates zoom 13 and it doesn't include most of markers, correct zoom will be 12.geoViewport.viewport([-112.16601, 37.622623, -112.082016, 37.672085], [672, 376])
Here is example URL for static map with zoom 13:
https://api.mapbox.com/styles/v1/tripexpertweb/ckcdpjifn06ru1impw321xsqi/static/pin-s+000(-112.15432,37.672085),pin-s+000(-112.082016,37.624809),pin-s+000(-112.16601,37.622623),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15611,37.64101),pin-s+000(-112.15611,37.64101)/-112.12401330471039,37.64735841514176,13/672x376@2x?access_token=pk.eyJ1IjoidHJpcGV4cGVydHdlYiIsImEiOiJja2Fud3l2MDcwbXZ0MndyeGF3eGI3ZWhzIn0.zLqNa1RECyZZadF8zfQM5w
And correct one with zoom 12:
https://api.mapbox.com/styles/v1/tripexpertweb/ckcdpjifn06ru1impw321xsqi/static/pin-s+000(-112.15432,37.672085),pin-s+000(-112.082016,37.624809),pin-s+000(-112.16601,37.622623),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15432,37.672085),pin-s+000(-112.15611,37.64101),pin-s+000(-112.15611,37.64101)/-112.12401330471039,37.64735841514176,12/672x376@2x?access_token=pk.eyJ1IjoidHJpcGV4cGVydHdlYiIsImEiOiJja2Fud3l2MDcwbXZ0MndyeGF3eGI3ZWhzIn0.zLqNa1RECyZZadF8zfQM5w
If I convert back to bounds from center and zoom, it doesn't match initial bounds:
geoViewport.bounds([-112.12401330471039, 37.64735841514176], 13, [672, 376])
[-112.1817398071289, 37.621845878167704, -112.0663833618164, 37.67295135774715]
In this case
[2.269904, 48.849976, 2.391055, 48.874565]
it calculates zoom 12 which is correct and includes all markers.The text was updated successfully, but these errors were encountered: