user5120455
user5120455

Reputation: 141

GMap.NET explicit load cache?

How do I explicitly load the Data.gmdb cache file in GMap.NET? I tried copying over the file created on my machine to another machine and run the application in offline mode but the cache file (generated in PC1-Online) does not work for PC2-Offline. Is there a way to explicitly load the file?

Upvotes: 2

Views: 5366

Answers (2)

woodchunk
woodchunk

Reputation: 1

at least after update to 2.1.7 CacheLocation only works if set in designer.vb

otherwise user/appdata/local folder is used

Upvotes: 0

Ivan Talalaev
Ivan Talalaev

Reputation: 6494

I think you could try to load your your-cache-file.gmdb into your application in this way:

In you MainForm_Load listener do the following:

 string pathToExecutable = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
 GMaps.Instance.ImportFromGMDB(pathToExecutable + "\your-cache-file.gmdb"); //or just whatever path to your cache 

Or in this way:

YourGMapControl.CacheLocation = System.IO.Path.GetDirectoryName(Application.ExecutablePath);

The last one creates TileDBv5/en/Data.gmdb in your executable directory folder, where cache to be replaced is located.

But! Don't forget about main things:

  1. Gmap will make cache data in MainMap.Manager.Mode = AccessMode.ServerAndCache; mode only. In CacheOnly it will use allready created cache, in ServerOnly it will load all the data from server without caching it locally.
  2. In order to force caching process use TilePrefetcher. Example here.

Upvotes: 2

Related Questions