ThinkGeo.com    |     Blog    |     Wiki    |     Support

Crash when zooming in rapidly with OSM maps

If I zoom in rapidly using the plus control I receive the following exception:

System.InvalidOperationException: The GeoCanvas is currently not drawing. Please call the BeginDraw method before calling this method.

This only happens when I use tile caching for the OSM overlay.
I am using FileBitmapTileCache with a png format.

Hi Richard,

From the exception information, it looks like that should be your code problem, something need be open before it is used.

So could you please provide us your code, you can also create a simple sample to reproduce the problem.

Regards,

Ethan

Using Thinkgeo smaple code for android I modified the code so that the OSM are in the sample, and modified the corresponding file UseOpenStreetMapOverlay.cs file by adding the following to set up a tile cache:

        FileBitmapTileCache bitmapTileCache = new FileBitmapTileCache();
        var documents = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
        var cachePath = System.IO.Path.Combine(documents, "CachedFiles");
        if (!System.IO.Directory.Exists(cachePath))
        {
            System.IO.Directory.CreateDirectory(cachePath);
        }
        bitmapTileCache.CacheDirectory = cachePath;
        bitmapTileCache.CacheId = "OSMCachedTiles";
        bitmapTileCache.ImageFormat = TileImageFormat.Png;
        osmOvelerlay.TileCache = bitmapTileCache;

This was added after the extents were set and prior to the overlay being added to the map. This does not generate the same exception that I am seeing in our application, but does cause an exception to be thrown while zooming in rapidly.

The exception in this case is

System.ObjectDisposedException: Cannot access a disposed object.

Object name: ‘ThinkGeo.MapSuite.Android.LayerTileView’.

For our application we use a common code set for WPF, Android, and iOS. The creation of the base map is identical in all 3 instances including the mechanism for setting up the cache. This problem does not exist if we do not use caching, and this problem only occurs with Android.

Problem does not occur if I let the map tiles fully paint prior to another zoom operation – only occurs if doing so before the screen fully updates. I can’ t exclude the possibility that our code is at fault, however I would expect it to fail in a similar way in the other platforms which it doesn’t

Hi Richard,

It looks I still hadn’t reproduce it, and I will setup the environment in a new machine to see whether I can reproduce it.

Any update I will let you know.

Regards,

Ethan

If it makes any difference we are using a Samsung galaxy tab A model SM-T580 for testing.
Andorid version 7

Hi Richard,

We found a Samsung device and test again, when we upgrade all packages to the latest version, we met an exception: System.NullReferenceException: Object reference not set to an instance of an object.

It looks it’s not the same like yours, our developer will look into it but it looks we still hadn’t reproduced your issue.

Regards,

Ethan

Hi Richard,

Our developer had fixed it, please upgrade the package to https://www.nuget.org/packages/MapSuiteMobileForAndroid-BareBone/11.0.0-beta035.

Regards,

Ethan

I will try and come up with a test case that I can send you. What I am seeing now after using the new beta is very slow performance. If only OSM are displayed it is not as noticeable although you can see the UI becoming unresponsive when zooming in rapidly via the zoom in button.

In my test code I have two linear SQLite feature layers being displayed. Once these layers are added into the mix the performance become painfully slow. From what I can tell it appears the ui becomes completely unresponsive while drawing layers. This behavior is the case with or without the file cache.

Switching back to the beta033 I notice that the point at which I generally get the exception is basically the same place that the UI becomes un-responsive with the beta035

Hi Richard,

So it looks the un-responsive is another problem and it’s not introduced by the latest version right?

If so could you please build a simple sample with your scenario to reproduce it? Before that you can also try to replace the SQLite layer with some simple layer and see whether it also have this problem.

Regards,

Ethan

The un-responsiveness was introduced in the latest version. I will try and get a sample built at some point this week. I will also try a shapeFile layer to see if I can duplicate with that.

Hi Richard,

Any update please let us know.

Regards,

Ethan

Sorry haven’t had a chance to get back to this. Will try and do so soon.

Hi Richard,

Thanks to let us know the updates.
If there is any issue after testing, please let us know that.

Thanks
Mark

We also have un-responsiveness while loading tiles (Osm or gmaps) on last 11beta37. The problem is not present on 10.2.8 (or at least it require a lot of quick moving and zooming to have a small lag).

Hi Judicael_ribault,

In fact the issue you reported is introduced when we fixed this issue.

Our developer is trying to solve both of them.

Please wait our reply in your ticket.

Regards,

Ethan