-
Notifications
You must be signed in to change notification settings - Fork 9
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
smooth zooming #13
smooth zooming #13
Conversation
The default now is much more like using google maps than what we have on master. Someone should try it ;) |
Updates:
|
from where this |
Is from MapTiles changes, see #18. |
It should be working now |
I think this is good to merge, just have to update the test for however many tiles there are now 😅 |
Sorry, I haven't really gotten to review this 😓 |
You should use it first ;) It's both higher res and just up-front cost of adding layers. After that much less are downloaded, because they're zoomed out and the ring around what you are currently looking at, which you would download next anyway. Removing the halo will cut the numbers a lot too. But Google totally downloads around the edges. Also, play with those two parameters before you go rewriting things... you can cut the downloads heaps by reducing them. I put heaps of work into this and the feel is really good compared to before. |
Edit: ok numbers are way down!! the problem was
The 16 - 40 range is because how I've used the The 25-70 numbers are just the same dynamic but with occasional extra halo tiles when near edges, and with the other zoomed out layers loading first. The immediate next layer will be 8 - 20 tiles, above that 4-10 tiles. Etc. Pretty quickly adding more layers has very little cost. |
I will check this later. But, did you test that this example works with this branch? It's the only one failing in the docs. |
Ah ok I wasn't sure what was happening there, will fix |
Also note: the We were getting different resolution on zoom in and zoom out with the old method. |
@SimonDanisch merge? |
This is definitely smooth. Looked at openstreetmap.org and this PR side-by-side, first Tyler and then openstreetmap.org:
At almost every zoom level I find the street names are too small to read, do others see the same? From the openstreetmap.org url you can also see that one scroll always directly jumps to the next zoom level, so you are never in between zoom levels. It looks like https://leafletjs.com/ is doing the same. Should we perhaps do the same by default, or as an option? For raster tiles with pre-rendered images at fixed zoom levels this makes sense, for vector tiles not anymore, hence for instance Google Maps zooming is much more continuous. |
I still think we should simply remove "less" tiles and be less greedy loading from further away zoom levels... But haven't had time to try it out compared to what's being done in this PR... |
@visr you can set the We could also target the mean resolution instead of minimum? so it is sometimes better sometimes worse than the figure resolution? My comparison is with google maps satellite view, which behaves pretty similar to this and has similar tile resolution, except it loads center out, which I'll add too when this is merged. Leaflet is different to google maps in that it loads one total layer then displays it at once, leaving the grey edges while you wait. You could add a leaflet mode that does that? @SimonDanisch what do you mean by remove less tiles? And we can totally change the default |
Though of course I'm only looking at OpenStreetMap examples. If I'm looking at sattellite images it might be nicer to see every pixel once on average. So a scaling option might be nice, keeping your current defaults. |
The letter size may be an artefact OSM server loads needing to serve less tiles. Google maps uses a lot more. But of course their text is separate from the tiles so they don't have that problem. I mostly made this PR using google satellite so the defaults mostly reflect that. (Try using the But yes I agree the mean is better and makes more sense, I will change it. Edit: we may need a scaling factor besides figure resolution to deal with tiles being meant for different resolutions? |
Haha posted the same idea before I read yours. Let's do that (scaling) |
it fail because of:
|
So on master we're doing this in pseudo code: newtiles= Set(get_tiles(visible_extent, zoom))
set_diff!(map.displayed_tiles, newtiles) # remove any tile that's not in newtiles Tiles are hashed by their x, y indices and zoom level, so if zooming in/out changes the zoom level, all tiles from the previous zoom level will get removed and we'll start displaying the new tiles from zero. newtiles = Set(get_tiles(visible_extent, zoom))
union!(map.displayed_tiles, newtiles) # add the newtiles that are perfect for visible_extent + zoom
filter!(map.displayed_tiles) do tile # filter out any tile outside the bounds
tile_extent = project(tile, TileIndexSpace, map.target_space)
return !(tile_extent in visible_extent) # or whatever method we have to figure out overlap
end This will leave any displayed tile from another zoom level that's still inside the bounds of the area we look at. |
Does anyone understand that GLFW error in the docs? |
than's a new one for me. Also, there is an strange error before And recently I learned that we should be using here
instead of @v2 as the one we are using now. |
Alright all green thanks @SimonDanisch ! Lets merge this before I have to rebase again, we can make changes in new PRs. The default tile number is now based on the mean resolution, there is a |
Thanks :) |
This PR plays with smooth zooming by plotting multiple layers at once.
Edits for changed syntax
This will plot 20 layers above (so zooming all the way out is pretty smooth):
But the defaults are best:
You can get close to the original behavior with this:
WithI removed this nowhigher_zoom > 0
the scale of the tiles in the plot will be too small. It would be good to load theses high res layers but not actually show the plots of them until we need to. But having the next layer already downloaded is nice for zooming in.Closes #17