This is a migrated thread and some comments may be shown as answers.

Refresh RapMap Provider

3 Answers 69 Views
Map
This is a migrated thread and some comments may be shown as answers.
Etienne
Top achievements
Rank 1
Etienne asked on 13 May 2016, 04:02 PM

Hello,

I’ve had issue with RadMap Provider cache in my application. My RadMap is connected to a local WMS (Geoserver). I've changed the map on the Geoserver to hide airport locations but it's not displayed in my RadMap (see attachments).

I have set the attribute "IsTileCachingEnabled = true" to enable tile caching (under %APPDATA%/Local/TelerikMapCache).
Then I added a function to clear the MapProvider when requested by the user :

            if (_mapProviderWrapper.MapProvider is WmsCustomProvider)
            {
                var wmsCustomProvider = (WmsCustomProvider)_mapProviderWrapper.MapProvider;
                var cacheStorage = wmsCustomProvider.CacheStorage as FileSystemCache;
                if (cacheStorage != null)
                {
                    string cachePath = cacheStorage.CachePath;
                    Directory.Delete(cachePath, true);
                    Directory.CreateDirectory(cachePath);
                }
            }

But even when the folder is empty and that I restart the application, RadMap still display airports which may means that tiles are cached somewhere else.
Is there a way to force a refresh of a MapProvider after the cache has been cleared?

Thanks!

Etienne

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 16 May 2016, 09:37 AM
Hello Etienne,

Thank you for contacting us.

The cached tiles are saved in the AppData folder as you mentioned in your post. The approach which you are using with deleting the folder should clear the cached tiles.
string profile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string cachePath = profile + "\\TelerikMapCache";
Directory.Delete(cachePath, true);
In addition you can try setting the provider's RequestCacheLevel property and set it to NoCacheNoStore. You can also check the other cache level options from the enumeration.

If this doesn't help you can prepare a small project that isolates the described behavior and send it via new support thread. 

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Etienne
Top achievements
Rank 1
answered on 16 May 2016, 06:40 PM

Hello Martin,

Thanks for your quick reply. It works if "RequestCacheLevel" is set to "NoCacheNoStore", but I would like to keep the local cache because my GeoServer is not always available.

It would be hard for me to provide you a small sample project as I would have to provide you my Geoserver and the procedure to apply modifications to demonstrate the issues that I am encountering.

I'm having a hard time to figure out where the MapProvider gets his tiled cache :
 1- I have set the RequestCacheLevel to CacheIfAvailable. 
 2- When I clear the cache (via my application), the folder AppData/Local/TelerikMapCache/WmsCustomProvider/ gets cleared.
 3- I observe that the RadMap is reloading.
 4- Then new files appears in the AppData/Local/TelerikMapCache/WmsCustomProvider/ folder.
 5- RadMap still display the old version of the map which is problematic.

Is there another cache somewhere that I am not aware of?

Thank you,

Etienne

0
Martin Ivanov
Telerik team
answered on 19 May 2016, 10:49 AM
Hi Etienne,

RadMap is caching its tiles only in a single location. However, if you are experiencing this behavior only at runtime it is possible the tiles to be still cached in the memory. In this case you can try to reset the CacheStorage property of the provider. Or call the Load() method of the FileSystemChache object (the value of the CacheStorage property) and get the newly stored tiles.

Please try those approaches and let me know if they work for you.

Regards,
Martin
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Map
Asked by
Etienne
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Etienne
Top achievements
Rank 1
Share this question
or