-
Notifications
You must be signed in to change notification settings - Fork 6
Update map tiles
Andrey Likhodievskiy edited this page Oct 9, 2018
·
2 revisions
Trigger. Set new projection. Explanation. When the viewport is changed some tiles may go off the screen or reappear again. Zooming makes it all much more interesting as it can cause changing of map zoom level. To simplify things and not fall into cumbersome analysis it's decided to recalculate and redraw all the needed tiles every time a projection is changed.
Algorithm:
- find out current map zoom level
- find out a visible point if there is one
- starting from the visible point detect all visible map tiles on the current zoom level and compose OpenGL texture
- divide each of the detected tiles to smaller chunks and include coordinates of the visible ones to OpenGL buffer array
It may be helpful to develop some or all of the following short methods:
- find out if a tile visible
- find out if a tile chunk visible
- detect file path to tile image by its coordinates
- convert map tile coordinate to geographic coordinates and vice versa