ThinkGeo.com    |     Documentation    |     Premium Support

Very poor performance with GoogleMapsLayer

Hi,

We have MS Desktop for winforms version 9.0.0.296 deployed in our production application. We have many clients and GoogleMapsLayer is working fine for all of them except one. For this one user, GoogleMapsLayer is so slow it is completely unusable. When loading for the first time it takes several minutes to load. Every map refresh after that takes several minutes.

I cannot reproduce the problem and our support staff cannot reproduce the problem. We have logged onto this user’s machine with TeamViewer (similar to RemoteDesktop) and we can see how poor the performance is for this particular user but no one else is having a problem.

Is there anything that could be causing this on a specific machine? Some setting we are missing? This user’s internet speed is good (> 30 mbps). Task manager does not reveal anything unusual.

Any idea?

Thanks!

Steve

Hi Steve,

Thanks for your detail description.

From the information, I guess that’s maybe because the proxy setting or some special firewall setting, because with the same code the other user works well, so the problem maybe not in the code side.

You can check something like this:

  1. Whether they set any proxy or open some utility like shadowsocks, whether they opened some tools like fiddler(simulate proxy server) and hadn’t closed correct.

  2. You should want to get some detail request url by our event sending request for your code, and directly open the urls in the user’s machine. Because internet speed is not equal the speed to connect a special remote server, so maybe their machine is hard to connect to Google’s static server.

  3. If user open firewall, maybe they want to check the rules of that.

Regards,

Don

Don,

Thanks for the information. We are continuing to have problems, here is a little bit more information. We did a test on the user’s machine (the one with the problem). We deleted all the files from the bitmap cache, Then we opened a Google Maps Layer and saw the folder fill up very quickly. However, after the cache folder is fully populated there is a big delay before the Google Map will draw. The delay is so long that sometimes a timeout occurs and the map does not draw at all. On our test machines we can see the folder filling with cache data and the map draws very quickly.

We have the same behavior with OpenStreetMapLayer.

Any further ideas?

Thanks!

Steve

Hi Steve,

We build a simple sample, you can try to run that in the user’s machine, and watch whether the simplest project also can reproduce the issue. So we can know whether that’s the problem from map or environment. And please copy the log.txt so we can see whether the sending request is correct.

And maybe you can try to set proxy in the user’s machine, see whether the map load get faster. Please replace the Google key with yours before test.

8677.zip (11.7 KB)

Regards,

Ethan,

Thanks, we will run the sample on the user’s machine. If we use a WebProxy what should the settings be? And why would it possibly run faster? Forgive my ignorance.

Thanks!

Steve

Hi Steve,

The proxy is just a optional test item, because you mentioned your user’s cache filled quickly so their machine should get fast to connect to Google’s static tile server, I want to see if connect to the tile server a little lag(point to a slower proxy server or some utility like shadowsocks in their machine just like we did) whether the render speed keep the same. If you that’s not easy to test you can just ignore it.

BTW, you can also test if the render speed is the same after you close the cache.

Regards,

Ethan

Ethan,

The only way I can make your sample project work is to alter it slightly:
public class CustomGoogleMap : GoogleMapsLayer
{

	protected override void OnCreatingRequest(ThinkGeo.MapSuite.Core.CreatingRequestGoogleMapsLayerEventArgs e)
	{
		e.RequestUri = new Uri(e.RequestUri.AbsoluteUri + "&key=googleKey");
		base.OnCreatingRequest(e);
	}

}

This is what we do in our application.

Steve

Hi Steve,

Please don’t public your key in forum, we have removed it from your code.

And do you means your code don’t works even you replace the key in our code? Please replace that because our test key should be invalid in code.

Any update about the test result please let us know.

Regards,

Ethan

Ethan,

Sorry, forgot to remove our key.

What I mean by you sample not working is that it works for awhile, then stops. Simply setting the PrivateKey property on the GoogleMapsLayer does not work long term. The only way I could get it to work was by sending our key with each request, as illustrated in my code sample.

Steve

Hi Steve,

Thanks to let us know that, our developer will test the sample for some hours today, but hadn’t reproduce it. Does the GoogleMapsLayer doesn’t work in the special user’s machine or in your development machine? How about our simplest sample works in your user’s machine after you modified that by the event?

Any update please let us know.

Regards,

Ethan

Hi Ethan,

Our support staff was able to run your simple sample on the user machine that’s having a problem (I did sightly modify your sample so it sends the key in OnCreatingRequest). They report the following:

I was able to open up google imagery very quickly and pan/zoom a couple of times. After about 10 seconds it locked up and gave me the following error message.

System.AggregateException: One or more errors occurred. —> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequestCore(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequest(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer./D0=(Object tileInfo)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
— End of inner exception stack trace —
at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.9z0=(RectangleShape canvasExtentForGoogleDrawing)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.9j0=(GeoCanvas canvas)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.DrawCore(GeoCanvas canvas, Collection1 labelsInAllLayers) at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection1 labelsInAllLayers)
at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.sRM=(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dhQ=(IEnumerable`1 drawingOverlays, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dRQ=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.lRQ=(RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.kBQ=(InteractionArguments interactionArguments)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ghQ=(Object sender, ChU= e)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.OnMouseEvent(ChU= e)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.CBU=(Double screenX, Double screenY, Double worldX, Double worldY, Int32 delta)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.jxQ=(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseWheel(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseWheel(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
—> (Inner Exception #0) System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequestCore(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequest(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer./D0=(Object tileInfo)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<—

************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2110.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

GoogleMapsLayerTest8677
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Delete%20me/GoogleMapTest/Release/GoogleMapsLayerTest8677.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2110.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2110.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2106.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

DesktopEdition
Assembly Version: 9.0.0.0
Win32 Version: 9.0.0.296
CodeBase: file:///C:/Delete%20me/GoogleMapTest/Release/DesktopEdition.DLL

MapSuiteCore
Assembly Version: 9.0.0.0
Win32 Version: 9.0.0.296
CodeBase: file:///C:/Delete%20me/GoogleMapTest/Release/MapSuiteCore.DLL

NetTopologySuite
Assembly Version: 1.7.3.31740
Win32 Version: 1.7.3.31740
CodeBase: file:///C:/Delete%20me/GoogleMapTest/Release/NetTopologySuite.DLL

Thanks!

Steve

Hi Steve,

Thanks for your update, it still looks because the request lost.

Today we discuss about that again, we list something here:

  1. The test sample is updated, we added some events try to catch the UnhandledException and save the Uri & exception information in a new log file, the uri should only works under single tile mode. Please add your key in code: 8677.zip (11.9 KB)

  2. You should want to test it for both single tile and multi tile mode, to make sure whether both of them can reproduce this exception.

  3. If you catch the exception uri, please copy that link and directly open it in the browser of your user’s machine, if this link cannot be opened in browser, it’s proved the network problem.

  4. Please let us know your user’s mainly environment information, so we can try to create a same setting machine to test again. Why we tried to test this is because if it’s really a network problem, I think we can do nothing for it, so we just want to make sure whether it’s not related with hardward and OS etc.

  5. Any further information please let us know.

Regards,

Ethan

Ethan,

Sorry for the delay.

The sample will not run at all in single tile mode. On my development machine I always get the following exception:

System.ArgumentException was unhandled by user code
  HResult=-2147024809
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
       at System.Drawing.Bitmap..ctor(String filename)
       at ThinkGeo.MapSuite.Core.GoogleMapsLayer.9D0=(GeoCanvas canvas)
       at ThinkGeo.MapSuite.Core.GoogleMapsLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
       at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
       at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
       at ThinkGeo.MapSuite.DesktopEdition.Overlay.sRM=(GeoCanvas canvas)
       at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dhQ=(IEnumerable`1 drawingOverlays, RectangleShape extent)
       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.dRQ=(RectangleShape drawingExtent, RectangleShape extent)
       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.lRQ=(RectangleShape extent)
       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.kxQ=(Int32 delayInterval, RectangleShape extent)
       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.Refresh()
       at GoogleMapsLayerTest8677.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\ZipPa\Documents\Visual Studio 2015\Projects\ThinkGeo\8677 Take 2\Form1.cs:line 53
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 

We ran the sample on the machine that was having the problem. And this time we also tested different locations for the BitmapFileCache. If we don’t set a location for the cache performance is good and we don’t get an exception. If we set a specific location for the BitmapFileCache performance is bad and we get and exception. The location we specified was:

C:\Users\<username>\AppData\Roaming\Silvics Solutions, LLC\Silvics 2.0\GoogleMapCache\Hybrid

I have attached the log file.
UnhandledExceptionLog.txt (2.4 KB)

Thanks again for your assistance,

Steve

Hi Steve,

Thanks for your update, we test that again and it still works well in our new machine with single tile mode, you can view the video here:
https://www.screencast.com/t/mBV9c530sP

From your exception it looks that’s caused by the missing image, if the GoogleLayer failed to get response from remote server that maybe get an invalid image, so we still guess that’s a network problem related with the environment of the special user.

It looks we haven’t more suggestion about that, if you found stop to set cache can solve it, could you please just use this as workaround for this user? Because for Google layer we have a default cache, the speed won’t get effect even you don’t set a custom cache location, please don’t set cache equal null that will disable cache.

BTW, please remove your key from your exception file.

If I missed any point please let me know.

Regards,

Ethan