BruTile FileCache and panning

Oct 21, 2011 at 4:44 PM


I'm using BruTile and MapsUI to develop an hybrid online/offline desktop map for our users. This is not a straightforward proposition and after several weeks of trying tons of different products and libraries, this project is just about as good as it gets.

I have noticed one problem, however, and I'm not sure where to go in the code to address it.

When the internet is connected the WebTileProvider downloads the tiles and Caches them on disk. When disconnected, the FileCache I have specified is used. As I zoom in, the previously cached tiles load just fine. However, once I am zoomed in, and I start panning around, or imagine I have a GPS connected and I drive up the road a bit, these tiles do not get replaced with the cache that I know I have. (I pre-cached all levels 0-15 for a small area) They remain the tile of potentially 2 or 3 zoom levels out, depending on how far I've panned from where I zoomed. However, if I zoom out past a zoom level and back into it, they get replaced just fine. I need to fix this such that panning will also trigger grabbing the tiles I have cached when not connected.

When the internet is working, panning fetches tiles correctly. I assume its a fairly straightforward fix, just that no one has noticed it.



Oct 24, 2011 at 3:22 PM

 So, it turns out, I precached up to 15, but I was at 16... simple enough.


Anyone have a suggestions as to a way to tell the map to load level 15 tiles if I'm at level 16 and those tiles are not cached?





Oct 25, 2011 at 6:40 AM


It shouldn't be that difficult. Take a look at ITileProvider interface. All you have to do is implement GetTile method and return tiles based on your logic - something like:

1. Find cached tiles based on TileInfo

2. If no tile is found look for tiles with greater/lower zoom level - crop/aggregate those tiles and return

The other solution would require you to change MapControl (imho),