starting with zoom=18

Topics: Etc...
Mar 13, 2012 at 9:58 AM
Edited Mar 13, 2012 at 10:06 AM

Hi to all, I need to start my application with the zoom set to 18. The problem is that the first tile (just the first) is not loaded correctly, BUT, if I start with zoom=0 and I put a Sleep(7000) and zoom=18 in the "OnTileLoadComplete" event (just the first time)  it works perfectly.  I use VS2010, WPF, OpenStreetMap provider, Release and Debug compiling. The sleep is just a work around and I don't like it, what can I do? Many thanks.

Mar 13, 2012 at 11:17 AM

show me the code, where do you set zoom values?

Mar 13, 2012 at 11:38 AM
Edited Mar 13, 2012 at 11:46 AM

This is in the costructor of MainWindow, after InitializeComponent():

MainMap.DragButton = MouseButton.Left;
MainMap.CanDragMap = true;
MainMap.MinZoom = 1;
MainMap.MaxZoom = 18;
MainMap.ShowCenter = false;
MainMap.Manager.Mode = AccessMode.ServerAndCache;
GMap.NET.MapProviders.GMapProvider.TimeoutMs = Properties.Settings.Default.MapProviderTimeoutMs;

MsSQLPureImageCache ch = new MsSQLPureImageCache();
ch.ConnectionString = Properties.Settings.Default.DBConnectionString;
MainMap.Manager.SecondaryCache = ch;
ch.Initialize();

MainMap.Zoom = 18;

MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);

----------------------------------------------------------------------------------------------------------------

in my case, if MainMap.Zoom is > 2, the map will not be fully loaded.

thank you

Mar 13, 2012 at 11:47 AM

why don't you set map provider?

Mar 13, 2012 at 11:54 AM

sorry, i'm forget to copy the first row:

MainMap.MapProvider = GMapProviders.OpenStreetMap;

MainMap.DragButton = MouseButton.Left;
MainMap.CanDragMap = true;
MainMap.MinZoom = 1;
MainMap.MaxZoom = 18;
MainMap.ShowCenter = false;
MainMap.Manager.Mode = AccessMode.ServerAndCache;
GMap.NET.MapProviders.GMapProvider.TimeoutMs = Properties.Settings.Default.MapProviderTimeoutMs;

MsSQLPureImageCache ch = new MsSQLPureImageCache();
ch.ConnectionString = Properties.Settings.Default.DBConnectionString;
MainMap.Manager.SecondaryCache = ch;
ch.Initialize();

MainMap.Zoom = 18;

MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);

Mar 13, 2012 at 12:27 PM

can you try temporary disable secondary cache?

Mar 13, 2012 at 2:01 PM

I have found the problem, there is another thread that set the Mode to CacheOnly, sorry and thank you....

Mar 13, 2012 at 2:15 PM

;}