Google and BingMaps take very long to load

Topics: General
Aug 17, 2011 at 9:34 PM

Hi Radioman!

With the latest GMaps version, GoogleMaps takes nearly 19 seconds to load, Bing maps nearly 9 seconds, whereas OpenstreetMaps takes only 1.5 seconds.

How can I speed up the load? Here's my testcode:

        private DateTime start;
        public Form1()
            start = DateTime.Now;
            map.MapProvider = GMapProviders.BingMap;
            map.Position = new PointLatLng(48, 16.4);
            map.MinZoom = 1;
            map.MaxZoom = 21;
            map.Zoom = 12; 

        private void Form1_Shown(object sender, EventArgs e)
            MessageBox.Show(String.Format("Loaded {0} in {1} seconds!", map.MapProvider.ToString(),  (DateTime.Now - start).TotalSeconds));

Thanks a lot!

Aug 17, 2011 at 9:46 PM

delay is only first time to get correct version numbers from google/bing, they change them to make life more complicated ;D

..actually versions are cached and reloaded each 8 hours

p.s. you can disable this by setting provider.TryCorrectVersion = false, but you'll get old tiles and probably be banned for a while ;}

Aug 17, 2011 at 10:33 PM

Thanks for your reply, can I also just remove this code from GoogleMapProvider.Cs OnInitialized() method:

if(Debugger.IsAttached && ver != old)

or is the Thread.Sleep(5555) method necessary?


Aug 18, 2011 at 7:45 AM

it's just for debugging, so i can see when versions changed, has no other meaning

Aug 23, 2011 at 8:45 AM

Is there any way to speed this up.  It didn't happen in previous versions.

Now my users are complaining about having to wait 20 seconds or so when they first go into a screen containing a map.



Aug 23, 2011 at 9:35 AM

How about storing the last checked date in the tiles database, and only set .TryCorrectVersion = true if different.  Then the versions will only be checked once each day, and not every time a new instance of the app is opened by each user ?

Aug 23, 2011 at 10:39 AM
Edited Aug 23, 2011 at 11:08 AM

Just remove the

if(Debugger.IsAttached && ver != old)

(3 times for Google Maps, 1 time for Bing Maps)

Then it takes only 1 or 2 seconds.
Aug 30, 2011 at 6:16 PM

versions are checked each 8 hours, in between using cached values

p.s. i do not recommend using debug versions, it's a lot slower