cache-levels and preloading

Topics: General
Feb 29, 2012 at 1:00 AM

Hi all,

In my program, while moving along a predefined path for the first time i see blank tiles (only for a second or 2) because they are not loaded yet. 
I'm looking for a way to avoid this. 
When I move along the path in the opposite direction it doesn't happen.

A while ago Radiomen stated the following:

"to be precise there are 5 levels of caching:

  1. decompressed raw bitmap tiles, in memory
  2. compressed tiles in their native format, in memory
  3. local sqlite/ce databse on your hdd
  4. [optional] second cache in LAN, mysql/mssql
  5. global servers, google/big/etc..."

I presume that when i move back, the tiles are still in the first (or second?) cache level.

is there a way to 'preload' a part (or as much as possible) from local sqllite-db in to the machine's memory?

And then another question: If the pre-allocated space from the database (250mb) is full, will it expand or just delete tiles, and, if so, which tiles would that be?

thx in advance

Feb 29, 2012 at 8:21 AM
  • there is no 'preloading' as you scroll the map new tiles are loaded into memory and old/invisible tiles are unloaded, though it would be possible to load more but that would eat your memory very quickly because raw bitmaps are quite huge, anyway there is always a space for improvements...
  • local cache has very high limit ~ 2TB, so no tiles are deleted, unless you manually delete them, Map.Manager.PrimaryCache.DeleteOlderThan
Mar 1, 2012 at 10:28 AM

thx for your quick reply. 


That was how i would resolve my issue, but just to be clear: you can think of no way to avoid displaying those 'empty' tiles while moving along a predefined path?


 thx in advance

Mar 1, 2012 at 12:14 PM

..it's complicated...

Mar 5, 2012 at 7:55 AM

How about (pre)loading a known set of (say 4x3) tiles for a given zoom into decompressed raw bitmap tiles? Is it possible to force preload into decompressed raw tiles of tiles in view for 1 zoom level above and below current level?

Mar 5, 2012 at 8:37 AM

it's possible, everything is possible ;}

Mar 5, 2012 at 9:14 AM

Say I have LevelsKeepInMemory = 7 and current Zoom = 12. I want to decompress tiles for levels 11 and 13. I can calculate tiles in view at each of those zoom and create RectLatLng for area in view at each zoom. I can then call Instance.GetImageFrom() but this only loads from DB to compressed tile in memory.

Can you point to a similar method to load a tile into decompressed raw bitmap in RAM?

Mar 5, 2012 at 9:22 AM

...try it yourself, can't help much here

Mar 5, 2012 at 10:56 AM
gvenkat_00 wrote:

How about (pre)loading a known set of (say 4x3) tiles for a given zoom into decompressed raw bitmap tiles? Is it possible to force preload into decompressed raw tiles of tiles in view for 1 zoom level above and below current level?

That's exactly what i am trying to do. Do you have any idea how i could do this? I just don't know where to begin. 

Mar 5, 2012 at 11:24 AM

Am i looking at the right page?
http://greatmaps.codeplex.com/SourceControl/changeset/view/0750e7861198#GMap.NET.Core%2fGMap.NET.CacheProviders%2fMemoryCache.cs

 

Mar 5, 2012 at 3:45 PM

Hi, just implemented the last version (beta) of the dll's, nice work Radioman.
The empty/blank tiles are often replaced with a part of a tile from a lower zoom-level, which makes the use of preloading in ram ALMOST unnecessary. Nice! 
I also screwed a bit with:
  MainMap.Manager.MemoryCache.Capacity = 100; 

Mar 5, 2012 at 3:58 PM

yes, lower zoom-level tiles are reused while loading current level, at least for mercator projection