ThinkGeo.com    |     Documentation    |     Premium Support

TileView stops updating

Hi,

We have an issue where sometimes a tile in map view stops updating.

We have LayerOverlay that has InMemoryFeatureLayers where we are updating features.
Sometimes updated features are not being drawn on TileView but instead TileView is showing some old image.

I have done some debugging by adding event handlers to Overlay’s DrawingTile and DrawnTile and dumped drawn image to a file.

When TileView stops updating it seems that following is happening:

DrawingTile:

  • GeoCanvas.CancellationTokenSource is always in Cancelled state (GeoCanvas.CancellationTokenSource.IsCancellationRequested)

DrawnTile:

  • When dumping DrawnTile.ImageSource it always contains same old image and is not updating.
  • It seems that GeoCanvas.NativeImage stops also updating (it’s empty)

I think problem happens when map is being redrawn and TileView is still drawing and drawing is cancelled.
-> GeoCanvas.CancellationTokenSource remains in cancelled state when next redraw(s) are done.

TileView recovers if map is panned so that tile goes completely out of view or map is zoomed.
I guess TileView is then recreated and it recovers?

I have made a workaround where I recreate GeoCanvas.CancellationTokenSource in DrawingTile phase and then it seems that TileView is updating correctly.

Currently we are using version 13.2.0-beta021.

Br,
Toni

Hi Toni,

  1. Please upgrade to the latest production release 13.2.1 NuGet Gallery | ThinkGeo.UI.Wpf 13.2.1. We made lots of improvements since beta021.

  2. Please make sure you are utilizing the Async APIs. A warning will be displayed if you are using the non-async ones. The HowDoI samples (dev branch) have been upgraded to use the Async APIs, it is using the beta nuget packages and we are in the middle of upgrading it to .net 8 and the new 13.2.1 release. You can go ahead and check out the code if you have any questions using the APIs. Files · develop · ThinkGeo / Public / Desktop Maps · GitLab

  3. Then please comment out your workaround code see if the issue still exists. If it does, please let me know:
    a. if GeoCanvas.CancellationTokenSource.IsCancellationRequested is true in DrawingTile event.
    b. In what scenario when some of the tileView stop drawing? panning the map?
    c. it will be great if you can send your mapping related code snippet.

  4. Just remind you that every asyn method in MapView has an overload accepts CancellationToken, which is necessary in some cases. For example, if you fresh map twice, you might want to cancel the previous RefreshAsync (by calling previousCancellationTokenSource.Cancel) before calling the 2nd RefreshAsync. It’s also what we do internally, for example if you pan the map twice, the mapView will cancel the previous refresh before the 2nd panning to avoid rendering twice.

I hope that helps.

Thanks,
Ben

Hi Ben,

Thanks for the reply.
We will update to the latest production release and see if the issue can be reproduced with that.

In beta021 TileView stopped updating while panning the map and at the same time updating features in InMemoryFeatureLayer. It does not happen always. It is happening randomly. Maybe depends on time when drawing is cancelled and the phase where drawing is in?

I’ll let you know if the problem is seen with production release.

Thanks,
Toni

Hi Toni,

An InMemoryFeatureLayer is usually suggested to add to a SingleTile instead of a MultiTile Overlay, because an InMemoryFeatureLayer usually is more “dynamic” as we might need to modify its features, and usually it doesn’t contain too many features so doesn’t need the tile cache enabled.

Can you set your overlay.TileType to SingleTile and have another try? As you’ve noticed, in MultiTile mode the tile will not be refreshed unless it’s been panned out of the view and panned back, SingleTile though will always refreshes after each time the extent is updated so it’s perfect for your scenario where the features are modified while panning.

Thanks,
Ben