Prefetching WMS with WebMap Plugin

Mar 29, 2013 at 1:25 PM
I'm using WebMap plug-in to draw WMS basemaps and I add real time data provided by a series of sensors and filters processing the sensor data, on a feature layer. So far I have managed to get basic functionality working, however we were told that the system may not be allways online therefore the maps should be offline.

I have tried to use extracted shapefiles from OpenStreetMap however rendering was slow. I have read about mapproxy and geowebcache but they seem to be overkill for the job because the software will be a standalone desktop application.

TileCache inside WebMap plugin actually works great when I draw an area but I need to prefetch a large area (an area as large as Germany) and I need it for all possible zoom levels. I think I'll implement this by iterating over the area with small steps, Is there anyone trying something like this? Dou you have any suggestions or code?
Apr 1, 2013 at 3:35 PM
All I can say is let us know how it goes. You are treading in unvisited territory... - Dan
Apr 2, 2013 at 5:48 AM
I've started on this yesterday, I'll share the results and the performance, here.
Apr 3, 2013 at 7:08 AM
I've put together a simple code to change the WebMap plug-in to solve the problem, the user provides
  • Starting extent,
  • Maximum extent
  • Step size in both directions
  • Zoom level
I start with starting extent,
shift it with step size in one direction,
when I reach the border of the maximum extent in that direction, I shift the starting extent in the other direction.
When the maximum extent is all covered, I shrink the starting extent and do the previous steps.

The performance is slow and but gets the job done.
When I finish my other chores, I'll try to organize the code and share
Apr 4, 2013 at 8:28 AM
OK, I admit, that was the worst idea for prefetching. It took 12 hours to go from zoom level 7 to zoom level 12, and considering the exponantial nature of the zooming it is going to take weeks to reach zoom level 18. On the other hand, after examining the TileManager code what needs to be done turns out to be very simple :

Calculate the x,y parameters for every zoom level for the area you are interested in, and use the GetTile(int x, int y, Envelope envelope, int zoom) function of TileManager class.