ThinkGeo.com    |     Documentation    |     Premium Support

Tiles from wrong zoomlevel on OpenStreetMap

Ok I will try again. Hopefully the image is included now.



I can add that I see a similar issue when working with heavy images on a GdiPlusRasterLayer with a FileBitmapTileCache. 



General map settings:

I have not set a ZoomLevelSet for the map, so it is just the default. 

MapUnit is meters. 

MapResizeMode=“PreserveScale” 



OpenStreetMapOverlay settings:

TileType = TileType.HybridTile;
TransitionEffect = TransitionEffect.Stretch;
IsBase = true; 

I have not changed Tile scale anywhere.



Thanks 

Jonas


brokenOSM.png (93.3 KB)

Hi Jonas, 
  
 Thanks for your image, yes you’re right, it looks there is a tile in the left side is not belong to current zoom level. 
  
 As below is the test code I did for that with the latest 9.0.265.0, it render the NewYork. I tried to keep zoom in/out and pan about 15 mins, but hadn’t succeed to reproduced that. So please view my code and see whether I missed any setting for map. 
  
 And please let me know whether it appear frequently, whether we can see that in a specified extent? 
  
  
  
 using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WpfDesktopEdition;

namespace CSHowDoISamples
{
    public partial class UseMicrosoftMapsLayer : UserControl
    {
        public UseMicrosoftMapsLayer()
        {
            InitializeComponent();
        }

        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.Meter;
            wpfMap1.MapResizeMode = MapResizeMode.PreserveScale;
            wpfMap1.CurrentExtent = new RectangleShape(-8252283.35963031, 4977643.2676051, -8237855.90662718, 4966177.7420397);

            OpenStreetMapOverlay osmo = new OpenStreetMapOverlay();
            osmo.TileType = TileType.HybridTile;
            osmo.TransitionEffect = TransitionEffect.Stretch;
            osmo.IsBase = true;

            wpfMap1.CurrentExtentChanged += wpfMap1_CurrentExtentChanged;

            wpfMap1.Overlays.Add(osmo);
            wpfMap1.Refresh();
        }

        private void wpfMap1_CurrentExtentChanged(object sender, CurrentExtentChangedWpfMapEventArgs e)
        {
            Debug.WriteLine(e.CurrentExtent.ToString());
        }
    }
 
  
 Regards, 
  
 Don

Hi Jonas,  
  
 Thanks for your image, yes you’re right, it looks there is a tile in the left side is not belong to current zoom level.  
  
 As below is the test code I did for that with the dll 9.0.0.175, it render the NewYork. I tried to keep zoom in/out and pan about 15 mins, but hadn’t succeed to reproduced that. So please view my code and see whether I missed any setting for map.  
  
 And please let me know whether it appear frequently, whether we can see that in a specified extent?  
  
 using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.WpfDesktopEdition;

namespace CSHowDoISamples
{
    public partial class UseMicrosoftMapsLayer : UserControl
    {
        public UseMicrosoftMapsLayer()
        {
            InitializeComponent();
        }

        private void WpfMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.Meter;
            wpfMap1.MapResizeMode = MapResizeMode.PreserveScale;
            wpfMap1.CurrentExtent = new RectangleShape(-8252283.35963031, 4977643.2676051, -8237855.90662718, 4966177.7420397);

            OpenStreetMapOverlay osmo = new OpenStreetMapOverlay();
            osmo.TileType = TileType.HybridTile;
            osmo.TransitionEffect = TransitionEffect.Stretch;
            osmo.IsBase = true;

            wpfMap1.CurrentExtentChanged += wpfMap1_CurrentExtentChanged;

            wpfMap1.Overlays.Add(osmo);
            wpfMap1.Refresh();
        }

        private void wpfMap1_CurrentExtentChanged(object sender, CurrentExtentChangedWpfMapEventArgs e)
        {
            Debug.WriteLine(e.CurrentExtent.ToString());
        }
    }
 
  
  
 Regards,  
  
 Don

Hi Jonas,  
  
 I tested that in a slow network environment again, and found sometimes a tile hadn’t get refreshed when I zoom in/out, but if I stay for a long time, it get refreshed. I am not sure whether that’s what you met, but it should be a network issue. 
  
 There are some solution for that: 
 1. Use SingleTile mode. The problem is the map looks render slow. 
 2. Clear the urls in openStreetMapOverlay.CustomServerUris and add the fastest urls in your network. The format should like this: 
    “a.tile.openstreetmap.org/{0}/{1}/{2}.png” 
    “b.tile.openstreetmap.org/{0}/{1}/{2}.png” 
    “c.tile.openstreetmap.org/{0}/{1}/{2}.png” 
 3. Pan or zoom one more time to force map refresh when you met that again. 
  
 Wish that’s helpful. 
  
 Regards, 
  
 Don

Hi Don  
 Thanks for your reply - I appreciate that you took the time to reproduce the issue. 
 The problem is not just that some tiles are wrong. It is worse because the wrong tiles are cached, and will appear until the program is restarted. This is not a very nice behavior.  
 As mentioned, I have seen the same behavior with a HybridTile GdiPlusRasterLayer on a LayerOverlay with a FileBitmapTileCache. It seems that if you start zooming before the map is done rendering all the tiles, there’s a chance it will cache something that doesn’t belong, especially if you also have other content on the map like the shapefile in my example. 
 To address your suggestions: 
 1: SingleTile seems to make the map unresponsive until it is done rendering. HybridTile gives a better user experience, and we would like to be able to continue using this option. 
 2: I dont understand this - can you elaborate? I dont know what you mean by adding the fastest urls in my network when your examples points to some OpenStreetMap server address. Do you mean that I should somehow find a server closer to my location? If that is the case, how can I do that? 
 3: This does not work when the tiles are cached, and I would not want to turn off the caching. Also, I believe it is against the usage terms: “Cache Tile downloads locally according to HTTP Expiry Header, alternatively a minimum of 7 days.” 
  
 In my view, there’s a bug in your caching mechanism that causes wrong tiles to be cached if the system is put under a bit of stress.

Hi Don

Thanks for your response. Somehow, your post has disappeared again from the site, maybe some issues with the redesign of your site.

I have sent a project that should make it possible for you to reproduce the issue. It includes a Visual Studio project and also a video wherein I reproduce the issue (21 seconds into the video). The shapefiles on the map are in different projection than the map, but I did not bother to convert projection so they are placed in a weird position, please ignore that.

I use MapSuite 9.0.0.175 (wpf desktop) dlls.

I found this other thread discussing the same issue:

To address your three points again:

1: Continue use multiply tile mode is OK, but the single tile will render the map after get the whole image, if you found singletile looks slow, that means your machine view OSM maybe not fast enough.

We will use HybridTile for OpenStreetMap overlay. SingleTile locks the map and gives a bad user experience, even on my modern i7 workstation with 1 gigabit connection.

2: I guess why that happen because when you zoom in one or more tiles hadn’t got response from the server, so it can only keep original image. If that’s the reason, it related with the network speed, so I suggest to find the fastest server, which can reduce the issue. I think you can just use single url for test, then find which one looks faster.

If network speed causes the framework to cache tiles from the wrong zoomlevel, I think the issue is primarily in the framework, not in the network speed. We have customers all over the world, and we cannot expect them all to have top notch network speed. That said, it even fails in my office, and as mentioned I’m on a 1 gigabit connection with low ping.
I have tried to use the CustomServerUris - I found that I could try to connect to http://a.tile.openstreetmap.de/{0}/{1}/{2}.png instead of http://a.tile.openstreetmap.org/{0}/{1}/{2}.png, but all I got was the pink exception tiles. Do you have some kind of documentation for OpenStreetMapOverlay?

3: By default the cache for overlay should be closed, if you assign cache for it, the tile will be cached to local, please can add code to manage them follow the usage terms.

The OpenStreetMapOverlay has a tilecache by default in \AppData\Local\Temp\MapSuite\OpenStreetMapTmpTileCache.

Best regards
Jonas

Hi Jonas,

Thanks for sharing the sample. It helps so much.
We focused on the issue and fixed it. This fix will be available in the version 9.0.275.0 or later. Please get it and have a try again.

Any questions please let us know.

Thanks,
Peter

Hi Jonas,

It seems that the server of http://a.tile.openstreetmap.de is not available.

In order to get the high performance on OpenStreetMapOverlay, it has a TileCache(an instance of FileBitmapTileCache) by default. And we can set the expiration time via the ExpirationTime property of FileBitmapTileCache.

More information abut OpenStreetMapOverlay please refer to these links:
http://wiki.thinkgeo.com/wiki/thinkgeo.mapsuite.wpfdesktopedition.openstreetmapoverlay
http://wiki.thinkgeo.com/wiki/map_suite_wpf_desktop_edition_all_samples#openstreetmap

Thanks,
Peter

Hi Peter

That is great news.
Version 9.0.275.0 is the development build, right?
Will this fix also be available in 9.0.0.275 - the production build?

Jonas

Hi Jonas,

Yes, the fixed will be available in Development build version 9.0.275.0 or higher. Please get it and have a try again.

This fix will not be available in the Production version unless it is stable.

Any questions please let us know.

Thanks,
Peter

Hi Peter

I have now tried the newest development version (9.0.280.0), and sadly I can still reproduce the problem. The fix did not do the trick I’m afraid.

I’m curious - can you say something about how you stabilize changes? If the fix did resolve the issue, how/when would you know that the fix is stable?

Jonas

Hi Jonas,

Very sad to hear that, but I can’t recreate this issue. Could you please tell us the testing environment?

We say it’s not stable, because it lack the regression testing. And we can know if the fix is stable by some ways, such as testing by ourselves, feedback from customers, etc.

Thanks,
Peter

Hi Jonas,

Please remember to clear the caching tiles before testing.

Thanks,
Peter

Hi Peter

My understanding is that by default, a new tilecache is started every time you create the overlay. But I made another test, this time making sure that the cache folder was empty beforehand, and I could still reproduce it. I have made a new video where I reproduce it using the sample project I sent you. The video has been sent to forumsupport@thinkgeo.com.

My environment:

Windows 8.1 Enterprise

CPU: Intel i7 4790K
Memory: 16 GBytes DDR3
Graphics: Asus Geforce GT 730
SSD: Samsung 840 Evo

Hi Jonas,

Sorry for the delay.

Thanks for your more information, it helps so much. Yes, you’re right, it seems that the bug wasn’t fixed successfully in the last Changeset, and it’s very difficult to fix. Our developer are still working on it. Any progress will be updated here.

Sorry for any inconvenience.

Thanks,
Peter

Hi Jonas,

I did some tests and it seems that that this bug has been fixed. It will be available in the version 9.0.296.0 or later. Please get it and try it again.

Any questions please let me know.

Thanks,
Peter

Hi Peter

Sorry for this late reply, I have been on vacation.

I tried the newest development build (9.0.309.0) and it really does look like you have fixed the problem. That is great!

Can you give an approximate time when this will go into the production builds? Days, weeks or months from now?

Best regards
Jonas

Hi Jonas,

Generally, we will move the change to release branch after it’s proved stable, so it should get moved for 10.0.

Do you think this change is very hurry and important for you to move to production build? If so please let us know, we can do some more test for this change and estimate when we can move it.

Regards,

Don

Hi Don

Can you give a hint when you expect to release version 10?
Then I can tell you if we can wait for that.

Thanks
Jonas

Hi Jonas,

I am not very sure about the exactly release time of version 10, because it looks we have big enhancement for 10.0. But I think it will release this year.

Regards,

Don