Map navigation is an important factor to take into account for a good user experience. When we pan and zoom the map, you'll often notice blank areas during transitions (because the content is loading), and after a few moments, the tile images appear.
On gridded layers (the focus of this recipe) and WMS layers working in single image mode, we can improve this at the cost of increasing the number of requests or increasing the computation time at the server side.
The idea behind improving map navigation is simple; load the tiles beyond the map view so that they are loaded before the user pans the map view in this direction or changes resolution, thus improving the navigation experience for users.
For this recipe we will create two side by side maps with tiled layers, one with (the top map) and one without (the bottom map) tile buffering enabled. You'll be able to see the differences when navigating around the two maps. The source code for this...